You are almost always better binding to the SelectedItem than the SelectedIndex. If the Item is null, the binding should fail gracefully.
I agree, SelectedItem does fail gracefully. – Nair Jun 16 at 13:47.
This is probably because the "Collection" attribute gets bound to the itemsource after the listbox is rendered. So if there is no collection(empty) then the first index 0 does not exist and it throws an "out of range exception". To resolve your issue set the selected index in code-behind after collection is populated.
Hope that helps.
That's a really nice explanation of why the error is occurring. However, I think Joel's answer of binding to SelectedItem is a better way to go. – Mike Post Jun 17 at 16:00 Agreed Mike.
Thanks – Zahid Sattar Jun 17 at 16:42.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.