项目右侧在ListView WPF中点击

时间:2015-10-13 20:00:25

标签: wpf listview right-click onitemclick

有没有办法在ListView或GridView上获得与ItemClick完全相同的OnItemRightTapped事件,除了明显只对右键进行反应?

1 个答案:

答案 0 :(得分:0)

您可以为鼠标按下添加事件处理程序,然后在代码中确定点击源:

    private void listView_MouseDown(object sender, MouseButtonEventArgs e)
    {
        if (e.ChangedButton == MouseButton.Right)
        {
            // Do what u need to do here
        }
        else
            e.Handled = true;            
    }