I have used the following code…
ComboboxItem item = new ComboboxItem();
item.Value = "M232M2333";
item.Text = "Apples";
comboSpriteSelect.Items.Add(item);
This is an example but in reality I’m reading hundreds of these values from a text file and applying them to the combobox.
I don’t seem to be able to get the .Value property back when I use .SelectedValue, but when I debug I see the value is assigned to the combobox.
lbl1.Text = comboSpriteSelect.SelectedValue.ToString();
Can anyone provide a solution? Is it because I’m not binding data?
Since you have
ComboboxItem object in combo items. Get the ComboboxItem from SelectedItem and take the value back of ComboboxItem class by casting the SelectedItem back to ComboboxItem .If
Value is not stringthen you may need to call ToString() on it