Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# how-to-bind-combobox-column-ItemsSource-from-view-model-in-wpf-and-uwp-treegrid-in-mvvm
# How to Bind Column ItemsSource from ViewModel in WPF / UWP TreeGrid in MVVM?

This example illustrates to bind the ComboBox column ItemsSource using MVVM.
This example illustrates how to bind the ComboBox column's **ItemsSource** using MVVM in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) / [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid) (SfTreeGrid).

You can bind the **ItemsSource** from ViewModel to [TreeGridComboBoxColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridComboBoxColumn.html) or using **ElementName** binding.

### XAML:

``` xml
<syncfusion:TreeGridComboBoxColumn AllowEditing="True"
MappingName="Title"
HeaderText="Title"
ItemsSource="{Binding DataContext.TitleList,
ElementName=treeGrid}" />
```

### C# ViewModel:
``` c#
private ObservableCollection<string> titleList;

public ObservableCollection<string> TitleList
{
get { return titleList; }
set { titleList = value; }
}
```

![How to Bind Column ItemsSource from ViewModel in WPF / UWP TreeGrid in MVVM](Bind_combobox_column_ItemsSource_from_view_model.png)