Binding ItemSource to GridComboBoxColumn

Hi
I try to bind a generic collection (`List`) to a GridComboBoxColumn in a SfDataGrid, but the items of the list aren't shown in the combo box.
XAML looks like this:
< syncfusion:GridComboBoxColumn HeaderText="Test Combo" AllowEditing="True" x:Name="cmbTest"/ >

while my C# looks like this:
private List comboList = new List { "Test1", "Test2", "test3" };
public MainWindow()
{
InitializeComponent();
this.cmbTest.ItemsSource = comboList;
this.Loaded += OnLoaded;
}
Can anyone assist me?

1 Reply 1 reply marked as answer

DM Dhanasekar Mohanraj Syncfusion Team October 5, 2020 10:52 AM UTC

Hi Jordy,

 
Thank you for using syncfusion controls.

 
You can bind the generic collection as a itemsource for the combobox like below,

 
<Window.Resources> 
    <local:ViewModel x:Key="viewModel"/> 
</Window.Resources>
<
syncfusion:GridComboBoxColumn MappingName="Test" AllowEditing="True" HeaderText ="Test Combo" ItemsSource="{Binding Test, Source={StaticResource viewModel}}"/> 

We have prepared the sample for the same, please refer the below sample and let us know if you need further assistance.

 

Regards,
Dhanasekar Mohanraj.


Marked as answer
Loader.
Up arrow icon