Last Updated: 16 Oct 2017 13:22 by ADMIN
Created on: 04 Sep 2017 12:15
Category: GridView
Type: Bug Report
Binding ItemsSource and SelectedItem of GridView changes SelectedItem
I have a RadGridView and bind its ItemsSource and its SelectedItem to properties of the ViewModel (DataContext). When the ViewModel is created, the property bound to ItemsSource is filled and the property bound to SelectedItem is set to one of the items in the collection.

However, when the GridView is displayed, the property is first set to null and then set to the first item in the collection. I assume that the binding of the SelectedItem is evaluated before the binding of the ItemsSource, so the grid is empty and the desired item can't be selected. Is there any way to influence the order, in which the binding are evaluated? Or is there any other way to avoid that the SelectedItem is changed?

A similar issue is described here:
Unfortunately, I couldn't to find the support ticket mentioned in this thread.
Posted on: 16 Oct 2017 13:22
Hello Patricia,

Thank you for the update. 

I am glad that you are no longer experiencing the problem. As we are not able to replicate it locally, I will proceed with setting the status of the item to Declined. Of course, if any other assistance with the selection of RadGridView is needed, please, open a new support ticket and describe your scenario in it. We will gladly assist you further.

All the best,
Posted on: 04 Oct 2017 12:17
Hello Stefan,

thank you for your answer and your sample application. 

With this sample application I also cannot reproduce my problem. I can still reproduce it with my application. However, I couldn't determine the relevant differences between my application and your sample application. 

Fortunately, this is no longer a problem because the selection in this situation is now handled differently.

Best regards,
Posted on: 20 Sep 2017 07:50
Hello Patricia,

I tested the behavior of the control in a setup similar to the described one, but was not able to replicate the reported behavior. Can you please take a look at the attached sample application I prepared? In what manner does it differ from your setup so that such issue is reproduced?

Kind regards,
Attached Files: