【问题标题】:Disable mouse right click event for GridView on WinRT C# app在 WinRT C# 应用程序上禁用 GridView 的鼠标右键单击事件
【发布时间】:2013-03-29 19:14:48
【问题描述】:

我的 WinRT 应用程序中有一个 GridView,问题是 gridViwes 的标准功能之一是当您单击右键(鼠标)时,单击的项目被选中, 这将专注于这个项目,并失去前一个项目的焦点, 我不会发生这种情况,我需要禁用右键单击鼠标 - 我认为这是解决方案,,, - 但是,如果您认为禁用鼠标右键单击事件是错误的,, 请给我其他建议!

【问题讨论】:

    标签: c# gridview windows-runtime right-click


    【解决方案1】:

    我认为这不是最好的解决方案,我真的不知道 WinRT 的 GridView,但我是 Silverlight 开发人员,所以我认为您可以订阅单元格的 MouseRightButtunUp/Down 事件并使用 @987654321 处理它们@ 在代码隐藏中。

    对于 WinRT(编辑):

        private void Target_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
         if (ptr.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse)
         {
            Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint(Target);
            if (ptrPt.Properties.IsLeftButtonPressed)
            {
            e.Handled = true;
            }
         }
        }
    

    希望这个有帮助!

    【讨论】:

    • WINRT 中不存在 MouseRightButtonUP/DOWN :/
    • 是的,你是对的。因为它也适用于平板电脑!它有一个指针按下事件。我正在根据这个编辑我的帖子。
    猜你喜欢
    • 1970-01-01
    • 2011-05-30
    • 1970-01-01
    • 1970-01-01
    • 2014-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多