Skip to content

Commit 1c8e1bc

Browse files
ES-975464 - Resolve ReadMe Length issue in this repository
1 parent 375f0f7 commit 1c8e1bc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
# how-to-bind-button-command-to-view-model-in-wpf-and-uwp-treegrid-in-mvvm
22

3-
This example illustrates to bind the button command to ViewModel in treegrid.
3+
This example illustrates to bind the `Button` command to ViewModel in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid).
4+
5+
You can load a `button` for the columns in treegrid using [TreeGridTemplateColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridTemplateColumn.html). When loading the buttons, you can bind a command in ViewModel using `ElementName` binding.
6+
7+
## XAML code:
8+
``` xml
9+
<syncfusion:TreeGridTemplateColumn MappingName="Title" syncfusion:FocusManagerHelper.WantsKeyInput="True">
10+
<syncfusion:TreeGridTemplateColumn.CellTemplate>
11+
<DataTemplate>
12+
<Button Content="Click" syncfusion:FocusManagerHelper.FocusedElement="True"
13+
Command="{Binding Path=DataContext.RowDataCommand,ElementName=treeGrid}" CommandParameter="{Binding}"/>
14+
</DataTemplate>
15+
</syncfusion:TreeGridTemplateColumn.CellTemplate>
16+
</syncfusion:TreeGridTemplateColumn>
17+
```

0 commit comments

Comments
 (0)