This example illustrates how to prevent the selection while pressing right click in WPF TreeGrid and UWP TreeGrid (SfTreeGrid).
You can prevent the selection when right-clicking in TreeGrid by customizing the SelectionController and overriding the ProcessPointerPressed.
protected override void ProcessPointerPressed(MouseButtonEventArgs args, RowColumnIndex rowColumnIndex) { if (args.ChangedButton == MouseButton.Right) { args.Handled = true; } else base.ProcessPointerPressed(args, rowColumnIndex); }You can prevent the selection when right-clicking in TreeGrid by customizing the SelectionController and overriding the ProcessPointerPressed.
protected override void ProcessPointerPressed(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex) { var properties = args.GetCurrentPoint(TreeGrid).Properties; if (properties.IsRightButtonPressed) { args.Handled = true; } else base.ProcessPointerPressed(args, rowColumnIndex); }