Skip to content

Binding TabControl Header with DisplayMemberPath does not work  #2816

@NeilMacMullen

Description

@NeilMacMullen

Bug explanation

When using this style of code...

<TabControl ItemsSource="{Binding Items}"
                  SelectedItem="{Binding ActiveItem}"
                  DisplayMemberPath="Name">

The tab header is displayed as the Name (or possibly ToString) of the bound model item.

The workaround is to specify the Header template....

 <TabControl ItemsSource="{Binding Items}"
                  SelectedItem="{Binding ActiveItem}"
                >
        <TabControl.ItemTemplate>
          <DataTemplate >
            <Viewbox
              Height="Auto">
              <TextBlock Text="{Binding Name}"/>
            </Viewbox>
          </DataTemplate>
        </TabControl.ItemTemplate> 

Version

4.5.0

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions