|
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? |
2 | 2 |
|
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). |
4 | 4 |
|
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. |
6 | 6 |
|
7 | 7 | ```xml |
8 | 8 | <syncfusion:TreeGridTemplateColumn MappingName="Title" syncfusion:FocusManagerHelper.WantsKeyInput="True"> |
9 | | - <syncfusion:TreeGridTemplateColumn.CellTemplate> |
| 9 | + <syncfusion:TreeGridTemplateColumn.CellTemplate> |
10 | 10 | <DataTemplate> |
11 | | - <TextBlock Text="{Binding Title}"/> |
| 11 | + <TextBlock Text="{Binding Title}"/> |
12 | 12 | </DataTemplate> |
13 | | - </syncfusion:TreeGridTemplateColumn.CellTemplate> |
14 | | - <syncfusion:TreeGridTemplateColumn.EditTemplate> |
| 13 | + </syncfusion:TreeGridTemplateColumn.CellTemplate> |
| 14 | + <syncfusion:TreeGridTemplateColumn.EditTemplate> |
15 | 15 | <DataTemplate> |
16 | | - <ComboBox ItemsSource="{Binding Path=DataContext.TitleList, ElementName=treeGrid}" /> |
| 16 | + <ComboBox ItemsSource="{Binding Path=DataContext.TitleList, ElementName=treeGrid}" /> |
17 | 17 | </DataTemplate> |
18 | 18 | </syncfusion:TreeGridTemplateColumn.EditTemplate> |
19 | 19 | </syncfusion:TreeGridTemplateColumn> |
20 | | -``` |
| 20 | +``` |
| 21 | + |
| 22 | + |
0 commit comments