Skip to content

Commit 86d1662

Browse files
ES-975464 - Changes committed
1 parent 04949b1 commit 86d1662

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed
137 KB
Loading

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
# how-to-bind-view-model-ItemsSource-to-combo-box-inside-template-in-wpf-and-uwp-treegrid-in-mvvm
1+
# How to Bind ViewModel ItemsSource to ComboBox inside Template in WPF / UWP TreeGrid in MVVM?
22

3-
This example illustrates to bind the ComboBox `ItemsSource` that is loaded inside the template column.
3+
This example illustrates to bind the ComboBox ItemsSource that is loaded inside the template column in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid) (SfTreeGrid).
44

5-
You can load a ComboBox inside [TreeGridTemplateColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridTemplateColumn.html) and bind the `ItemsSource` from ViewModel to ComboBox using `ElementName` binding.
5+
You can load a ComboBox inside [TreeGridTemplateColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridTemplateColumn.html) and bind the ItemsSource from ViewModel to ComboBox using ElementName binding.
66

77
```xml
88
<syncfusion:TreeGridTemplateColumn MappingName="Title" syncfusion:FocusManagerHelper.WantsKeyInput="True">
9-
<syncfusion:TreeGridTemplateColumn.CellTemplate>
9+
<syncfusion:TreeGridTemplateColumn.CellTemplate>
1010
<DataTemplate>
11-
<TextBlock Text="{Binding Title}"/>
11+
<TextBlock Text="{Binding Title}"/>
1212
</DataTemplate>
13-
</syncfusion:TreeGridTemplateColumn.CellTemplate>
14-
<syncfusion:TreeGridTemplateColumn.EditTemplate>
13+
</syncfusion:TreeGridTemplateColumn.CellTemplate>
14+
<syncfusion:TreeGridTemplateColumn.EditTemplate>
1515
<DataTemplate>
16-
<ComboBox ItemsSource="{Binding Path=DataContext.TitleList, ElementName=treeGrid}" />
16+
<ComboBox ItemsSource="{Binding Path=DataContext.TitleList, ElementName=treeGrid}" />
1717
</DataTemplate>
1818
</syncfusion:TreeGridTemplateColumn.EditTemplate>
1919
</syncfusion:TreeGridTemplateColumn>
20-
```
20+
```
21+
22+
![How to Bind ViewModel ItemsSource to ComboBox inside Template in WPF / UWP TreeGrid in MVVM](Bind_viewmodel_ItemsSource_to_ComboBox_inside_template.png)

0 commit comments

Comments
 (0)