Home Forums WPF controls Xceed DataGrid for WPF DataGridControl.MouseWheelEvent problem

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23750 |

    I have a problem with catching the mouseWheel events:

    EventManager.RegisterClassHandler(typeof(Xceed.Wpf.DataGrid.DataGridControl),
    Xceed.Wpf.DataGrid.DataGridControl.MouseWheelEvent, new MouseWheelEventHandler(MyMouseWheelEventHandler));

    void MyMouseWheelEventHandler(Object sender, MouseWheelEventArgs e)
    {
    MessageBox.Show(“wheel “);
    }

    it never calls the event handler.

    On the contrary, the same works for double-click:

    EventManager.RegisterClassHandler(typeof(Xceed.Wpf.DataGrid.DataGridControl),
    Xceed.Wpf.DataGrid.DataGridControl.MouseDoubleClickEvent, new MouseButtonEventHandler(OnDataRowMouseDoubleClick));

    private void OnDataRowMouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
    MessageBox.Show(“DoubleClick “);
    }

    Is it a bug ?

    Is there any other way?
    I would need the WouseWheel event for the whole DataGridControl (not only
    for the DataRows) (scrollbar and specially the empty area is important too)

    I tried to hook to the MouseWheel event of the whole window:
    public partial class MainPage : Page
    {
    public MainPage()
    {
    MouseWheel += new MouseWheelEventHandler(MainPage_MouseWheel);
    }
    }
    but it seems that the DataGridControl eats the message and does not pass the event
    to the Page.

    Thanks

    Imported from legacy forums. Posted by agy666 (had 996 views)

    Xceed Support
    Member
    Post count: 5658

    Probably that the MouseWheelEvent is handled by the ScrollViewer, which is part of the DataGridControl’s ControlTemplate…

    Since the MouseWheelEvent has a “bubbling” routing strategy, you should try with the PreviewMouseWheelEvent, which is “tunelling”.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 207 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you, the “PreviewMouseWheelEvent”,

    namely the
    ” EventManager.RegisterClassHandler(typeof(Xceed.Wpf.DataGrid.DataGridControl),
    Xceed.Wpf.DataGrid.DataGridControl.PreviewMouseWheelEvent,
    new MouseWheelEventHandler(DataGridPreviewMouseWheelEventHandler));

    worked perfectly.

    Imported from legacy forums. Posted by agy666 (had 3891 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.