Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
304
Fetching dynamic data collection
posted

We have a scenario where we will have to execute stored procedures and display the data on xamgrid. Some of the stored procedure return upto 50K records and therefore we would like to display them using virtual collection. However, we also have a scenario where the output of the stored procedures can change at times(may return new set of columns) based on the business requirement. We would not like to change the model everytime that happens hence we return a standard type of IEnumerable<Dictionary<string, object>>. Please let me know if its still feasible to use virtual collection under the given constraints.

Parents
No Data
Reply
  • 6759
    Offline posted

    Hi,

    sorry for the late response,

    there is no problem using VirtualCollection as long as you use a Dictionary<string, object> as items.

    From XamGrid point of view you will need to use XamGrid's String Indexers Support feature. This approach will work well if:

    • Every time the set of columns is expected to be changed the xamGrid's columns collection should be updated. All Columns registered in XamGrid should be able to resolve their key, otherwise KeyNotFoundException will be thrown.
    • All Dictionaries in your ItemsSource should have same keys. Every dictionary should have key for each column defined in the grid

    I have attached a sample solution outlining this approach(xamGrid part only).

    Sincerely,

    SilverlightApplication10.zip
Children