patrick
patrick

Reputation: 16979

Set TabItem header as TextBlock in XAML

Right now I have something like this:

<TabItem Name="tbActive" Width="100" Height="100"  Header="Current" >

and in the code behind I set the Header -- so setting it above is a bit pointless

TextBlock tb = new TextBlock();
tb.Text = "Current";
tb.MouseDown += new MouseButtonEventHandler(tb_MouseDown);
tbActive.Header = tb;

I don't want to use this code behind... I'd rather it all be XAML. So how can I set the 4 textblock lines in my TabItem XAML ?

Upvotes: 0

Views: 1960

Answers (1)

Pavlo Glazkov
Pavlo Glazkov

Reputation: 20756

<TabItem Name="tbActive" Width="100" Height="100">
    <TabItem.Header>
         <TextBlock Text="Current"
                    MouseDown="tb_MouseDown"/>
    </TabItem.Header>
</TabItem>

Upvotes: 4

Related Questions