Skip to content

Commit abe827e

Browse files
authored
Merge pull request #2 from SyncfusionExamples/ES-975464
ES-975464 - Resolve Issues ReadMe length issue in this repository
2 parents 0ca014b + c9f082b commit abe827e

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ComboBoxInsideTemplate.png

137 KB
Loading

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +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 ComBox 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+
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+
7+
```xml
8+
<syncfusion:TreeGridTemplateColumn MappingName="Title" syncfusion:FocusManagerHelper.WantsKeyInput="True">
9+
<syncfusion:TreeGridTemplateColumn.CellTemplate>
10+
<DataTemplate>
11+
<TextBlock Text="{Binding Title}"/>
12+
</DataTemplate>
13+
</syncfusion:TreeGridTemplateColumn.CellTemplate>
14+
<syncfusion:TreeGridTemplateColumn.EditTemplate>
15+
<DataTemplate>
16+
<ComboBox ItemsSource="{Binding Path=DataContext.TitleList, ElementName=treeGrid}" />
17+
</DataTemplate>
18+
</syncfusion:TreeGridTemplateColumn.EditTemplate>
19+
</syncfusion:TreeGridTemplateColumn>
20+
```
21+
22+
![Loading ItemsSource to combobox inside Template](ComboBoxInsideTemplate.png)

0 commit comments

Comments
 (0)