开发者

Set TabItem header as TextBlock in XAML

开发者 https://www.devze.com 2023-03-02 04:39 出处:网络
Right now I have something like this: <TabItem Name=\"tbActive\" Width=\"100\" Height=\"100\"Header=\"Current\" >

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 ?


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

精彩评论

暂无评论...
验证码 换一张
取 消