From f248b6fb88357c5310f73c0d3f9eaca999dc964d Mon Sep 17 00:00:00 2001 From: Sreemon Premkumar M Date: Thu, 14 Aug 2025 13:37:17 +0530 Subject: [PATCH 1/3] ES-975464 - Resolve ReadMe length Issues in this Repository --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d32837..7cec4b9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,42 @@ # how-to-bind-the-SelectedItem-property-of-wpf-tree-grid-in-mvvm -This example illustrates to bind the SelectedItem property from ViewModel to treegrid. \ No newline at end of file +This example illustrates to bind the `SelectedItem` property from ViewModel to the [SelectedItem](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectedItem) Property of [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid). + +You can bind the `SelectedItem` property directly to `TreeGrid` by setting the [SfTreeGrid.SelectedItem](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectedItem) property. + +## XAML code: + +``` xml + + +``` + +## C# code: + +``` C# +public class ViewModel: NotificationObject +{ + private object selectedItem; + public object SelectedItem + { + get + { + return selectedItem; + } + set + { + selectedItem = value; + RaisePropertyChanged("SelectedItem"); + } + } +} +``` \ No newline at end of file From 0e17a3b3df6a40e15dea62b32e4131787696be58 Mon Sep 17 00:00:00 2001 From: SreemonPremkumarMuthukrishnan Date: Wed, 22 Oct 2025 01:08:47 +0530 Subject: [PATCH 2/3] ES-975464 - Changed committed --- README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 7cec4b9..68a3c35 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,27 @@ -# how-to-bind-the-SelectedItem-property-of-wpf-tree-grid-in-mvvm +# How to Bind the SelectedItem Property of WPF TreeGrid in MVVM? -This example illustrates to bind the `SelectedItem` property from ViewModel to the [SelectedItem](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectedItem) Property of [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid). +This example illustrates to bind the **SelectedItem** property from ViewModel to the [SelectedItem](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectedItem) Property of [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid) (SfTreeGrid). -You can bind the `SelectedItem` property directly to `TreeGrid` by setting the [SfTreeGrid.SelectedItem](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfGridBase.html#Syncfusion_UI_Xaml_Grid_SfGridBase_SelectedItem) property. +You can bind the **SelectedItem** property directly to TreeGrid by setting the **SfTreeGrid.SelectedItem** property. -## XAML code: +### XAML: ``` xml + Grid.Row="1" + ChildPropertyName="ReportsTo" + AutoExpandMode="AllNodesExpanded" + ShowRowHeader="True" + SelectedItem="{Binding SelectedItem, Mode=TwoWay, + UpdateSourceTrigger=PropertyChanged}" + AutoGenerateColumns="False" + ItemsSource="{Binding Employees}" + ParentPropertyName="ID" + SelfRelationRootValue="-1"/> ``` -## C# code: +### C#: ``` C# public class ViewModel: NotificationObject From 2e98be3ba6a512381e7f432e2fbb80dcf0967c56 Mon Sep 17 00:00:00 2001 From: SreemonPremkumarM Date: Wed, 22 Oct 2025 22:43:33 +0530 Subject: [PATCH 3/3] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68a3c35..51435cd 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ You can bind the **SelectedItem** property directly to TreeGrid by setting the * public class ViewModel: NotificationObject { private object selectedItem; + public object SelectedItem { get @@ -40,4 +41,4 @@ public class ViewModel: NotificationObject } } } -``` \ No newline at end of file +```