.net 失去焦点时更改选项卡项目标题背景颜色?
我想我的标签项目的标题的背景颜色改变时,失去重点。我想知道实现这一点的最佳方法是什么,是否可以实现纯XAML解决方案?我不知道最佳方法。我知道这条路.net 失去焦点时更改选项卡项目标题背景颜色?,.net,wpf,xaml,.net-4.0,tabitem,.net,Wpf,Xaml,.net 4.0,Tabitem,我想我的标签项目的标题的背景颜色改变时,失去重点。我想知道实现这一点的最佳方法是什么,是否可以实现纯XAML解决方案?我不知道最佳方法。我知道这条路 <Window x:Class="WpfTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xm
<Window x:Class="WpfTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfTest"
Title="MainWindow" Height="350" Width="300">
<Window.Resources>
<Style TargetType="TabItem">
<Style.Triggers>
<Trigger Property="IsFocused" Value="False">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<StackPanel>
<TabControl Height="100" Name="tabControl1" Width="200">
<TabItem Header="tabItem1" Name="tabItem1">
<Grid />
</TabItem>
<TabItem Header="tabItem2" Name="tabItem2">
<Grid />
</TabItem>
</TabControl>
</StackPanel>
</Window>
选项卡失去焦点时已更改颜色(返回默认值)。你能更具体地说明你想要什么吗?谢谢,我没有意识到你必须通过这样的样式来实现,我想可能有某种方法可以将XAML保留在本地控制节点中。Style
have reusableapproach。