Combobox.SelectedItem assignment not working when adding items statically
-
I am having an issue and have scoured the net looking for an answer and I still have yet to find one so I thought I would post here while continuing my search. I simply want to set SelectedItem to a string value and have it select that item from the combobox. Now I am adding my items to the combobox statically during design time and when I do this, SelectedItem doesn't work and always is null. However I just found out that when I add my combobox items during runtime, selectedItem works just fine. Now I would like to know why this is. I am guessing that it is some binding that automatically happens when adding them dynamically, but I would love to know how to get this working statically. Thanks!
-
I am having an issue and have scoured the net looking for an answer and I still have yet to find one so I thought I would post here while continuing my search. I simply want to set SelectedItem to a string value and have it select that item from the combobox. Now I am adding my items to the combobox statically during design time and when I do this, SelectedItem doesn't work and always is null. However I just found out that when I add my combobox items during runtime, selectedItem works just fine. Now I would like to know why this is. I am guessing that it is some binding that automatically happens when adding them dynamically, but I would love to know how to get this working statically. Thanks!
Please specify which version of the framework you are using. Assuming that this is a WPF application.
-
Please specify which version of the framework you are using. Assuming that this is a WPF application.