Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 失去焦点时更改选项卡项目标题背景颜色?_.net_Wpf_Xaml_.net 4.0_Tabitem - Fatal编程技术网

.net 失去焦点时更改选项卡项目标题背景颜色?

.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

我想我的标签项目的标题的背景颜色改变时,失去重点。我想知道实现这一点的最佳方法是什么,是否可以实现纯XAML解决方案?

我不知道最佳方法。我知道这条路

<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。