You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# How to Bind Columns from ViewModel in WPF / UWP TreeGrid in MVVM?
2
2
3
-
This example illustrates to bind the columns from ViewmModel in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid)
3
+
This example illustrates to bind the columns from ViewModel in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid) (SfTreeGrid).
4
4
5
-
You can bind the [SfTreeGrid.Columns](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_Columns) property in ViewModel by having the binding property of `Syncfusion.SfGrid.UI.Xaml.TreeGrid.Columns` type. Thus, you can set binding to the `SfTreeGrid.Columns` property that provides DataContext of `TreeGrid` in ViewModel.
5
+
You can bind the [SfTreeGrid.Columns](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid.html#Syncfusion_UI_Xaml_TreeGrid_SfTreeGrid_Columns) property in ViewModel by having the binding property of **Syncfusion.SfGrid.UI.Xaml.TreeGrid.Columns** type. Thus, you can set binding to the **SfTreeGrid.Columns** property that provides DataContext of TreeGrid in ViewModel.
6
6
7
-
## XAML code:
7
+
###XAML:
8
8
9
9
```xml
10
10
<syncfusion:SfTreeGridName="treeGrid"
@@ -20,23 +20,30 @@ You can bind the [SfTreeGrid.Columns](https://help.syncfusion.com/cr/wpf/Syncfus
20
20
</syncfusion:SfTreeGrid>
21
21
```
22
22
23
-
Refer to the following code example in which the TreeGrid column is populated with some `TreeGridTextColumn` when creating the ViewModel instance.
23
+
Refer to the following code example in which the TreeGrid column is populated with some [TreeGridTextColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridTextColumn.html) when creating the ViewModel instance.
0 commit comments