Skip to content

Commit 7a2ef71

Browse files
authored
Merge pull request #1 from SyncfusionExamples/ES-975464
ES-975464 - Resolve the ReadMe file length issue in this sample repository
2 parents 3ce02e0 + f77e28e commit 7a2ef71

File tree

2 files changed

+36
-1030
lines changed

2 files changed

+36
-1030
lines changed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
# How to prevent the selection while pressing right click in wpf and uwp treegrid?
2-
This example illustrates how to prevent the selection while pressing right click in wpf and uwp treegrid
1+
# How to Prevent the Selection While Pressing Right Click in WPF / UWP TreeGrid?
2+
3+
This example illustrates how to prevent the selection while pressing right click in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid) (SfTreeGrid).
4+
5+
## For WPF:
6+
7+
You can prevent the selection when right-clicking in TreeGrid by customizing the [SelectionController](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_SelectionController) and overriding the [ProcessPointerPressed](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowSelectionController.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridRowSelectionController_ProcessPointerPressed_System_Windows_Input_MouseButtonEventArgs_Syncfusion_UI_Xaml_ScrollAxis_RowColumnIndex_).
8+
9+
``` csharp
10+
protected override void ProcessPointerPressed(MouseButtonEventArgs args, RowColumnIndex rowColumnIndex)
11+
{
12+
if (args.ChangedButton == MouseButton.Right)
13+
{
14+
args.Handled = true;
15+
}
16+
else
17+
base.ProcessPointerPressed(args, rowColumnIndex);
18+
}
19+
```
20+
21+
## For UWP:
22+
23+
You can prevent the selection when right-clicking in TreeGrid by customizing the [SelectionController](https://help.syncfusion.com/cr/uwp/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowSelectionController.html) and overriding the [ProcessPointerPressed](https://help.syncfusion.com/cr/uwp/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowSelectionController.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridRowSelectionController_ProcessPointerPressed_Windows_UI_Xaml_Input_PointerRoutedEventArgs_Syncfusion_UI_Xaml_ScrollAxis_RowColumnIndex_).
24+
25+
``` csharp
26+
protected override void ProcessPointerPressed(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex)
27+
{
28+
var properties = args.GetCurrentPoint(TreeGrid).Properties;
29+
if (properties.IsRightButtonPressed)
30+
{
31+
args.Handled = true;
32+
}
33+
else
34+
base.ProcessPointerPressed(args, rowColumnIndex);
35+
}
36+
```

0 commit comments

Comments
 (0)