Method OnItemsChanged
contains this code:
// Re-synchronize SelectedIndex with SelectedItem if necessary
if (!object.Equals(Items[SelectedIndex], SelectedItem))
wich throw ArgumentOutOfRangeException when i set SelectedItem before ItemsSource. SelectedIndex in this scenario is -1 and execution Items[SelectedIndex] throw exception.
in my opinion, "if" instruction must contains check SelectedIndex not equal -1. like this: if (SelectedIndex != -1 || !object.Equals(Items[SelectedIndex], SelectedItem))
thanks...
Comments:
contains this code:
// Re-synchronize SelectedIndex with SelectedItem if necessary
if (!object.Equals(Items[SelectedIndex], SelectedItem))
wich throw ArgumentOutOfRangeException when i set SelectedItem before ItemsSource. SelectedIndex in this scenario is -1 and execution Items[SelectedIndex] throw exception.
in my opinion, "if" instruction must contains check SelectedIndex not equal -1. like this: if (SelectedIndex != -1 || !object.Equals(Items[SelectedIndex], SelectedItem))
thanks...
Comments:
Dupe of http://silverlight.codeplex.com/workitem/7561