Skip to content

SyncfusionExamples/how-to-prevent-the-selection-while-pressing-right-click-in-wpf-and-uwp-treegrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to Prevent the Selection While Pressing Right Click in WPF / UWP TreeGrid?

This example illustrates how to prevent the selection while pressing right click in WPF TreeGrid and UWP TreeGrid (SfTreeGrid).

For WPF:

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); }

For UWP:

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); }

About

This example illustrates how to prevent the selection while pressing right click in wpf and uwp treegrid

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages