GridComboBoxColumn binding question

Hi,

I have created a SfDataGrid and binded the itemsource with a viewmodel that comes from ADO.NET Entity Framework in the same way as in your documentation.
I need to have a column of type GridComboBoxColumn but I have problems when it comes to bind its value and display a different value.

Let's say I have a model class Type with two properties (int id, string type), and another class A with two properties (int name, int typeId), this class A has a navigation to the class Type (foreign key typeId points to id from Type). And the viewmodel has an ObservableCollection.






3 Replies

SJ Sathiyathanam Jeyakumar Syncfusion Team July 13, 2018 05:37 AM UTC

Hi Xavi, 
 
Thank you for contacting syncfusion support. 
 
We have analyzed your query and we suspect that you have required to load the different ItemsSource to each row of GridComboBoxColumn. You can achieve this requirement by using the ItemSourceSelector property of GridComboBoxColumn. In each row you can load the string type items in the GridComboBoxColumn based on the typeId. 
 
You can refer the ItemsSourceSelector and its uses from the below UG/ KB link. 
 
 
 
 
 
 
Dashboard Sample Location: C:\Users\Public\Documents\Syncfusion\WPF\{installed Syncfusion ES build version}\SfGrid.WPF\Samples\ComboBoxColumnsDemo 
 
Sample Explanation: The following screenshot illustrates the different ShipCity ItemsSource bound to each row of the ComboBox based on the Country Name. 
 
 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Sathiyathanam 



XA Xavi July 13, 2018 09:57 AM UTC

I finally got it working.

I didn't actually need to change the ItemsSource for each row (every row with the same ItemsSource).
Using the MappingName, DisplayMemberPath and SelectedValuePath did the trick.

Thanks for the help!


JG Jai Ganesh S Syncfusion Team July 16, 2018 04:29 AM UTC

Hi Xavi,  
 
Thank you for the update. 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Jai Ganesh S 


Loader.
Up arrow icon