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
440
xamwebgrid itemssource cannot be cleared or set to null.
posted

I am using xamwebgrid for which I have to create columns dynamically. I have a scenario wherein when I change selection in dropdown, I need to bind the xamwebgrid with a List whose type is different from the first list that is bound to the datagrid. So before assigning the itemssource I need to again create columns for the same grid as the properties in the second type are different. So I clear the columns(grid.Columns.Clear()) and add the new columns that have different Key from the first columncollection. But as I am doing this on the same instance of xamwebgrid, it is still bound to the old itemssource. So the properties in my itemssource and columns key do not match and I get an exception. I tried setting the itemssource to null. But it still has a count. Is there anyway I can resolve this?

Parents
  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I set the XamGrid’s AutoGenerateColumns Property to false and used Dispatcher to add the Column. Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.

    SilverlightApplication1.zip
Reply Children