按钮的默认背景颜色

pap*_*zzo 5 .net wpf button

想要匹配按钮的默认背景颜色以在Expander中使用.
按钮的默认背景颜色是什么?

我到底尝试了什么?
很多不同的颜色,但没有找到匹配.

pap*_*zzo 11

Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
Run Code Online (Sandbox Code Playgroud)


Sme*_*egs 5

在WPF中,您可以右键单击元素并选择“编辑模板”,这将创建控件使用的确切模板,包括背景色。然后,您可以将相同的生成背景色应用于所需的任何控件。

另外,如果您只想复制单个画笔,则可以转到该控件的画笔属性,然后单击小方块并选择“转换为新资源”。然后将新生成的画笔应用于所需的任何元素。

结果如下

<Window x:Class="WpfApplication2.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <LinearGradientBrush x:Key="Brush1" EndPoint="0,1" StartPoint="0,0">
        <GradientStop Color="#FFF3F3F3" Offset="0"/>
        <GradientStop Color="#FFEBEBEB" Offset="0.5"/>
        <GradientStop Color="#FFDDDDDD" Offset="0.5"/>
        <GradientStop Color="#FFCDCDCD" Offset="1"/>
    </LinearGradientBrush>
</Window.Resources>
<Grid>
    <Button Content="Button" HorizontalAlignment="Left" Margin="151,139,0,0" VerticalAlignment="Top" Width="75" Background="{DynamicResource Brush1}"/>
    <Expander Header="Expander" HorizontalAlignment="Left" Margin="412,129,0,0" VerticalAlignment="Top" Background="{DynamicResource Brush1}">
        <Grid Background="#FFE5E5E5"/>
    </Expander>

</Grid>
Run Code Online (Sandbox Code Playgroud)