❔ Anyone knows how to have a "default value" in a ComboBox?
I mean like before even clicking the button to open the scroll-down menu, already having some text written down in there...Something like "Please Select" or maybe the last option in the ComboBox selected...
And if you google it and find a StackOverflow thread where they explain how to do it, that doesn't work for me cause I'm doing it by creating a list of strings in the code that's behind the XAML with the strings that will show up as options in the ComboBox whereas they're doing it all directly in the XAML which if I do it in the "behind" code and also put stuff inside the
<ComboBox/>
tag it will throw up an exception, and I don't know how to put all the data directly in the XAML...3 Replies
Sorry if that's confusing, ask me questions if you need to, I'll be glad to answer
You can either utilize a watermark in the combobox, or add an entry with the title - "Select something". In the latter case, you'd set that entry as selected by default, and ensure that your validation logic checks that a user has selected anything but that default entry
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.