This is a migrated thread and some comments may be shown as answers.

Problem binding a Dictionary to a Grid

1 Answer 105 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 12 Apr 2009, 07:49 PM
Hi,

I have a Dictionary:

public Dictionary<string, Unit> Template { get; set; } 

And I'm trying to bind it to my grid:

myGrid.ItemsSource = myInstance.Template; 

So far it works, but when I try to add or edit new rows, I'm not able to edit any cell. I've tried every combination of DataMemberBinding, DataMemberPath, object creation in the AddingNewDataItem event, Anonymous types, etc. with no success.

Is there a way to bind a Dictionary to a grid and create new entries for it?





1 Answer, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 14 Apr 2009, 01:39 PM
Hi Luis,

Unfortunately RadGridView can not handle value updates to a Dictionary. The reason is that the Key and Value fields of the KeyValuePair are readonly.  Even if you add a new item to the RadGridView( within the

AddingNewDataItem event) you will not be able to edit newly added data and submit it respectively.
If using a dictionary is  a must and cannot be replaced with another "more editable" collection , let me know. In such case I can try help you with a workaround (e.g. using some wrapper collection).

Regards,

Pavel Pavlov
the Telerik team

 


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Luis
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or