[英]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在后面的代码中我设置了 Header - 所以在上面设置它有点毫无意义
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.我不想在后面使用这个代码......我宁愿它都是 XAML。 So how can I set the 4 textblock lines in my TabItem XAML?
那么如何在我的 TabItem XAML 中设置 4 个文本块行?
<TabItem Name="tbActive" Width="100" Height="100">
<TabItem.Header>
<TextBlock Text="Current"
MouseDown="tb_MouseDown"/>
</TabItem.Header>
</TabItem>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.