We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Binding ItemsSource of GridComboBoxColumn


I'm using the SfDataGrid, and trying to use GridComboBoxColumn.
In the examples, I've seen that the ItemsSource has usually a binding to a StaticResource, therefore it is shared across all the rows of the datagrid.
Now, my requirement would be to have an ItemsSource variable row by row. Basically, the ViewModel that is bound to each row, would contain both the IEnumerable (to be bound to ItemsSource) and the property to be bound to the selected item, via SelectedValuePath.

Just as an example, this is the pseudo-code

<sync:GridComboBoxColumn HeaderText="Title"
                                         ItemsSource="{Binding AvailableTitles}"
                                         AllowEditing="True" />

Where AvailableTitles and SelectedTitle are both properties of the viemodel class for each row.
This doesn't seem to work.

I've attached a ZIP that contains a demo solution for this.
Could you please indicate how I can achieve my requirement?


Attachment: SfDataGrid_Combobox1_4021a3bf.zip

4 Replies

SM Saravanan M Syncfusion Team February 10, 2015 04:21 AM UTC

Hi Emanuele,

We have checked with your sample . You have set DataContext  as MainViewModel for Window. But it does not have AvilableTitles property which is  binded for ComboBox ItemsSource. So you need to define the property in MainViewModel .

We have modified the sample based on your requirement and you can download it from below location.

Sample Location: SfDataGrid_Combobox1.zip

Please refer the below code snippet.

Code snippet[XAML]:

<sync:GridComboBoxColumn AllowEditing="True"


                         ItemsSource="{Binding Path=DataContext.AvailableTitles,


                         MappingName="SelectedTitle" />

Please let us know if you have any other queries,



SM Saravanan M Syncfusion Team February 11, 2015 05:43 AM UTC

Hi Emanuele,

Please ignore our previous update,

You can set the ItemsSource for each row based on the Gender by using GridTemplateColumn, where we have loaded the TextBlock in CellTemplate and ComboBox in EditTemplate  with ItemsSource binding as you requested. We have prepared a sample based on this and you can download it from below location

Sample Location: SfDataGrid_Combobox1.zip

Please refer the below code snippet

Code snippet[XAML]:

<sync:GridTemplateColumn HeaderText="Title" MappingName="SelectedTitle">



              <TextBlock Margin="2,0" Text="{Binding Path=SelectedTitle}" />





               <ComboBox ItemsSource="{Binding AvailableTitles}" SelectedValue="{Binding Path=SelectedTitle}" />






EP Emanuele Panzavolta February 11, 2015 08:14 AM UTC

Hi Saravanan, thanks for your last update. In fact this is what I meant, to set ItemsSource for each row, based on Gender. It's a pity that this is not possible directly in GridComboBox column, but the solution you suggest (to use GridTemplateColumn) allows to accomplish the goal; so thanks for that!

Many thanks,

SM Saravanan M Syncfusion Team February 12, 2015 12:26 PM UTC

Hi Emanuele

Thanks for your update. Please let us know if you need further assistance .



Live Chat Icon For mobile
Up arrow icon