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
C# 将鼠标悬停在组合框等对象上时的默认蓝色_C#_Wpf_Combobox_Default - Fatal编程技术网

C# 将鼠标悬停在组合框等对象上时的默认蓝色

C# 将鼠标悬停在组合框等对象上时的默认蓝色,c#,wpf,combobox,default,C#,Wpf,Combobox,Default,可能重复: 首先很抱歉,如果这个问题得到了回答,我整个晚上都在浏览谷歌,试图找到一个解决方案,甚至不确定我搜索的内容是否正确 我的问题是,当我单击/悬停在组合框/按钮上时,它会显示默认的系统蓝色,我希望能够将其删除或将其更改为在组合框中的选择上悬停时使用的灰色。这是一个WPF项目,我添加了一些图片来说明问题所在。 我试过几种不同的方法,但都没有成功。我希望我忽略了一个简单的设置 在高层次上,您需要 这是一篇关于如何让它看起来完全不同的好文章 要更改默认颜色,您需要这种类型的xmal(取自此)

可能重复:

首先很抱歉,如果这个问题得到了回答,我整个晚上都在浏览谷歌,试图找到一个解决方案,甚至不确定我搜索的内容是否正确

我的问题是,当我单击/悬停在组合框/按钮上时,它会显示默认的系统蓝色,我希望能够将其删除或将其更改为在组合框中的选择上悬停时使用的灰色。这是一个WPF项目,我添加了一些图片来说明问题所在。 我试过几种不同的方法,但都没有成功。我希望我忽略了一个简单的设置


在高层次上,您需要

这是一篇关于如何让它看起来完全不同的好文章

要更改默认颜色,您需要这种类型的xmal(取自此)



当鼠标悬停在控件上时,要更改控件中选定项的颜色,还是在鼠标悬停在控件上时更改控件的颜色。两种不同的动物。@TonyHopkinson知道年轻人是蓝色组合框,可以获得系统颜色这是你需要的吗?
 <ControlTemplate x:Key="CustomToggleButton" TargetType="ToggleButton">
    <Grid>
        <Border Name="Border" />
        <Border Name="SmallBorder" />
        <Path Name="Arrow" />
    </Grid>
</ControlTemplate>

<Style TargetType="{x:Type ComboBoxItem}">
    <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
    <Setter Property="Control.Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                <Border>
                    <ContentPresenter />
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

<Style TargetType="{x:Type ComboBox}">
    <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
    <Setter Property="Control.Template">
        <Setter.Value>
            <ControlTemplate TargetType="ComboBox">
                <Grid>
                    <ToggleButton Template="{StaticResource CustomToggleButton}" />
                    <ContentPresenter />
                    <TextBox />
                    <Popup>
                        <Grid>
                            <Border>
                                <ScrollViewer>
                                    <ItemsPresenter />
                                </ScrollViewer>
                            </Border>
                        </Grid>
                    </Popup>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>