Home Forums WPF controls Xceed DataGrid for WPF Problem with "refreshing" MyDataGrid.ItemsSource

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22682 |

    I’m having trouble “refreshing” an instance of the datagrid. The first time I bind to a dataset, it works great, I can see the exact dataset I was expecting.

    But the second time I bind to a new dataset, the same data continues to be displayed on the datagrid. I am sure the new dataset is different than the previous; I run the stored procedure on the server that returns the data and can clearly see different results (different data in my dataset) and I also placed a breakpoint on the client and inspected the dataset.

    Here’s the code I’m using to bind:

    MyDataGrid.Items.Clear()
    MyDataGrid.ItemsSource = MyWebServiceResponse.ResultDataSet.Tables(0).DefaultView

    Is this a bug or is there something else I should be doing for the datagrid to display the correct data? I upgraded today to the latest datagrid (Xceed.Wpf.DataGrid.dll 1.0.7170.16090).

    Imported from legacy forums. Posted by Emmanuel (had 3388 views)

    Xceed Support
    Member
    Post count: 5658

    This is a bug that was already identified and fixed… Unfortunately, the fix did not make it in time for the latest build.

    The fix can be expected “soon” ( We already mentioned that we are targeting beginning of May ).

    Imported from legacy forums. Posted by Marcus [Xceed] (had 368 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Marcus,

    Thanks for letting me know. Is there any workaround? I tried created a new instance of the datagridcontrol but that didn’t work. Is there anything I could do to make this work until the fix comes out in May?

    Imported from legacy forums. Posted by Emmanuel (had 259 views)

    User (Old forums)
    Member
    Post count: 23064

    we have one solution for your problem

    create the datagrid columns on the serverside and bind them there itself, donot create the grid columns on design page, if so you wont see the effected results when you rebind

    when ever you want to rebind the data you need to clear all the grid columns and again you need to do the samething mentioned above

    suresh katari

    Imported from legacy forums. Posted by Suresh (had 559 views)

    User (Old forums)
    Member
    Post count: 23064

    That worked, THANKS!

    I was already creating the dataset on the server side and binding it to the datagridcontrol, so your response got me thinking. After stepping in through the code I found that this line:

    MyDataGrid.Items.Clear()

    was actually raising an exception (telling me I cannot change the items (but that I should instead change the underlying itemsource).

    The problem was that I was catching the exception and not displaying it to the user. Once I removed the above line, the refreshing of the itemsource actually worked great.

    THANKS AGAIN!

    Imported from legacy forums. Posted by Emmanuel (had 5187 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.