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

Returning a dictionary (key/value pair) of objects

1 Answer 162 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 13 Jan 2016, 06:39 PM

I haven't had the opportunity to test this yet, but can Telerik UI controls (say a radGridView) ItemsSource be bound to Dictionary(of String, myclassObject)?

1.  Are GridViewDataColumn DataMemberBinding={Binding   ... any different?  ... Will I see my web service return data?

2.  Any differences in Notify events like OnPropertyChanged()?

3.  Assuming WCF, is there anything special I need to do when configuring my application to use the service that returns a Dictionary - example: configure web service to generate message contracts and providing specific collection and dictionary collection type?  Or can this option be left unchecked?

Cheers, Rob.

 NOTE: what I typically do is work with Dictionaries on the server side (standard .NET code) then when I need to return them, I convert them over to standard collection ... List(Of myclassObject).  However it would be nice if I could skip this step in terms of efficiency.

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 18 Jan 2016, 04:39 PM
Hi Rob,

RadGridView actually wraps any collection you bind to it in a queryable as it needs the IQueryable support for the data operations to work properly. Provided that your business object implements INotifyPropertyChanged, I think it would be fine if you bind the control to the Values property of a Dictionary if that is what you have in mind.

I haven't tried that with a WCF service and can't tell what you need to adjust, but the topic seems to be widely discussed on general programming forums, for example at Passing a Dictionary to WCF service on .

I hope this helps.

Regards,
Petya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Rob Ainscough
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or