Skip to content

SyncfusionExamples/how-to-bind-view-model-ItemsSource-to-combo-box-inside-template-in-wpf-and-uwp-treegrid-in-mvvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to Bind ViewModel ItemsSource to ComboBox inside Template in WPF / UWP TreeGrid in MVVM?

This example illustrates to bind the ComboBox ItemsSource that is loaded inside the template column in WPF TreeGrid and UWP TreeGrid (SfTreeGrid).

You can load a ComboBox inside TreeGridTemplateColumn and bind the ItemsSource from ViewModel to ComboBox using ElementName binding.

<syncfusion:TreeGridTemplateColumn MappingName="Title" syncfusion:FocusManagerHelper.WantsKeyInput="True">
        <syncfusion:TreeGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Title}"/>
            </DataTemplate>
        </syncfusion:TreeGridTemplateColumn.CellTemplate>
        <syncfusion:TreeGridTemplateColumn.EditTemplate>
            <DataTemplate>
                <ComboBox ItemsSource="{Binding Path=DataContext.TitleList, ElementName=treeGrid}" />
            </DataTemplate>
        </syncfusion:TreeGridTemplateColumn.EditTemplate>
 </syncfusion:TreeGridTemplateColumn>

Loading ItemsSource to combobox inside Template

About

This example illustrates to bind the ComboBox ItemsSource that is loaded inside the template column.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages