1

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?

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Kyle Hale
  • 7,912
  • 1
  • 37
  • 58

1 Answers1

1

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...

H.B.
  • 166,899
  • 29
  • 327
  • 400