Saturday, June 18, 2011

Setting SelectedIndex property of combobox resulted in "Specified argument was out of range" exception

While working on a SketchFlow prototype, I got this exception
"Specificed argument was out of range"
when attempting to set the value of ComboBox.SelectedIndex in the LayoutRoot_Loaded event handler. It used to occur randomly, so I concluded that this could be the result of some behavior not entirely under my control.
I got rid of this exception by setting the SelectedIndex propertly in the ComboBox_Loaded event handler. Hope this helps someone there with a similar issue. :)

1 comment:

Gary & Sarah said...

Thanks for the example. I was having the same problem.

What is success?

The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired,...