views:

15

answers:

1

I want to get the header of a selected tab-item of a tab-control and activate another tab-item of another tab-control appropriately, eg. select tab "A"/"B" of tab-control TC1 will activate tab "A"/"B" on tab-control TC2.

I want "A", "B", ... to be a enum value so that no string comparation is used. So, how can I use an enum value to set the tab-item's header?

[Edit] And yes, I prefer to use the enum value directly in XAML codes

+1  A: 

I'd say use a WPF ValueConverter.

In Xaml,
<Tab Header={Binding PropThatReturnsTheEnum, Converter=EnumToDisplayTextConverter}>....</Tab>

On the other hand, if you're implying that you want to set the text of the tab to a named member of an enumeration hardcoded in XAML, you could use the Static MarkupExtension

<Tab Header={x:Static local:MyEnum.Member1}>... </Tab>

Gishu