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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding ItemsSource of GridComboBoxColumn

Thread ID:





118162 Feb 6,2015 09:27 AM UTC Feb 12,2015 12:26 PM UTC WPF 4
Tags: SfDataGrid
Emanuele Panzavolta
Asked On February 6, 2015 09:27 AM UTC


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

Saravanan M [Syncfusion]
Replied On 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,



Saravanan M [Syncfusion]
Replied On 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}" />






Emanuele Panzavolta
Replied On 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,

Saravanan M [Syncfusion]
Replied On February 12, 2015 12:26 PM UTC

Hi Emanuele

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




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon