Returning a dictionary (key/value pair) of objects

2 posts, 0 answers
  1. Rob Ainscough
    Rob Ainscough avatar
    172 posts
    Member since:
    Jan 2010

    Posted 13 Jan Link to this post

    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.

  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 18 Jan Link to this post

    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 stackoverflow.

    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
  3. DevCraft banner
Back to Top