I am new to WPF and MVVM. In my ViewModel I have collection of items, for example:
class Item {
string Title {get; set;}
string Description {get; set;}
}
I would like to create a view, so at the beginning I would have:
Title1
Title2
Title3
If user click on one of title it will expand to show description, eg:
Title1
Description1
Title2
Title3
If user click on other title, there will be two expanded items:
Title1
Description1
Title2
Description2
Title3
This is probably very similar to Expander control and maybe I could use it, but I am doing it other way, to learn something new.
What control should I use for this purpose? Should that be ItemsControl or maybe ListBox?
I imagine, that if I use ItemsControl, I should probably extend my Item class to have something like bool IsExpanded and bind UI item visibility to that value. But maybe I could use ListBox and somehow bind UI item visibility to... Yeah, to what? :)
How could I do such a simple thing?