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.
Unfortunately, activation email could not send to your email. Please try again.

How to bind to the GridComboBoxColumn's ItemsSource?

Thread ID:

Created:

Updated:

Platform:

Replies:

115536 Jan 21,2014 10:34 AM Jul 21,2014 05:21 AM WPF 8
loading
Tags: GridControl
Om Thapa
Asked On January 21, 2014 10:34 AM

Hi,
I am using the index binding as MappingName for a GridComboBoxColumn. And I need to get the item source from the same object I am bound to. But I can't figure out how to do it.
Scenario: I have a Customer object which has a dictionary containing cells. So, 
MappingName  is something like "Cells[CellName].Value". And the item source is also in the same object pointed by the binding "Cells[CellName].ComboBoxList".

I tried to use the BindingOperations, as you explained above but I don't have the source to bind to, as it is determined dynamically by the grid.
Thanks,
Om

Saravanan M [Syncfusion]
Replied On January 23, 2014 06:43 AM

Hi Om,

Thank you for contacting Syncfusion support, 

We have analyzed you query. It you want to set item source for combo box you need to create collection for the combo box and you can set as item source to combo box. Please refer the below code snippet.

Code snippet[C#]:

GridDataColumnStyle columnstyle = new GridDataColumnStyle();

columnstyle.CellType = "ComboBox";

columnstyle.ItemsSource = ItemList;

 

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

 

Sample location: GridDataControlSample combobox.zip

 

Please let us know if this sample helps you,

Regards,

Saravanan.M


Om Thapa
Replied On January 23, 2014 02:43 PM

Hi Saravanan,

I am sorry I forgot to mention that I was having this issue in SfDataGrid. The solution you provided is for GridDataControl. 

Thanks,
Om

Jai Ganesh S [Syncfusion]
Replied On January 29, 2014 03:37 AM

Hi Om,

 

Thank you for using Syncfusion products.

 

We have analyzed your query. You can not directly set the index binding as a ItemSource  for a GridComboBoxColumn. However you can achieve your requirement by writing the  Custom GridCellComboBoxRenderer class and override the OnInitializedEditElement method. We have prepared the sample based on this and please find the sample under the following location,

 

Sample: SfDataGridComboboxSample Dictionary.zip

 

Please let us know if you need further assistance.

 

Thank you,

Jai Ganesh S


Om Thapa
Replied On January 30, 2014 05:45 PM

Hello Jai,

With the sample code you posted, I can now bind to the ItemSource. However, if I change the droplist value it doesn't reflect the change in the cell (Cell is blank) even though it changes the value of the model object. I see the same issue with your sample code.
Thanks,
Om 

Jai Ganesh S [Syncfusion]
Replied On February 4, 2014 12:03 AM

Hi Om,

 

Thank you for your update.

 

We have analyzed your query. We are unable to reproduce the reported issue in our sample. Could you please share your sample along with the replication procedure? This would be more helpful for us to serve you in a better way.

 

Please let us know if you need further assistance.

 

Thank you,

Jai Ganesh S


Om Thapa
Replied On February 4, 2014 09:50 AM

Jai,

I can easily reproduce the issue I mentioned above. This is what I am doing.
In the sample program that you have attached in this forum, change the droplist value to something. At this point it looks like value is selected, however as soon as you move to a different row or column, the value disappears and grid cell is empty.

Thanks,
Om

 

Jai Ganesh S [Syncfusion]
Replied On February 13, 2014 04:00 AM

Hi Om,

 

Thank you for your update.

 

We have tested the sample based on your scenario but we are unable to reproduce the issue. Please find the video illustrating this attached below.

 

Video: SampleVideo.zip

 

Please let us know if you have any queries.

 

Thank you,

Jai Ganesh S


steohly
Replied On July 21, 2014 05:21 AM

Hi, even i have the same problem of the cell not getting updated to the value selected. Could you please tell me how you resolved this problem.

CONFIRMATION

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.

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.

;