Frage

So I have as the main user control in my WPF app a TabControl that will support several different views (basically forms for data entry) and their underlying view models (basically ORM mappings.)

I built a ContentTemplateSelector to throw out the correct content view for the selected item.

So my question is:

Should I build an ItemTemplateSelector to select the correct property from the underlying view model that will act as the tab header title?

Or, should I assign a property from each view model to another property called something like DisplayTitle and then use that in the ItemTemplate?

And more generally, is there a way to combine the "selection" of an ItemTemplate and ContentTemplate under a single selector?

War es hilfreich?

Lösung

I usually use type based data-templating for the content and a common property (set as DisplayMemberPath) or an attribute on the class for the header (in case there is one item per class).

I doubt that you can conveniently combine the selectors, nor do i like selectors in general...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top