I am making my first gui in C# and I have watched/read a ton of tutorials about WPF and MVVM(that’s the approach I’m using), but I am stuck on something that intuitively should be rather simple to accomplish. I have a listbox, and above it I would like to display a textblock or label that would say “Please select item from list” and then disappear once an item is selected.
How can I accomplish this? Would it require writing in the code-behind? Most tutorials I have read discourage ever using the code-behind so I would prefer a different solution. I assume this is not possible to do directly from within XAML, so would I need to create a ViewModel variable to hold the listbox state?? If so, then how could I make a textblock/label dependent on a variable?
For doing this in XAML only
ItemsSource="12345"will create five rows for demonstration only.