1

这是我的 xaml,不会为任何 devexpress 控件呈现背景属性。如何覆盖内置属性。

      <dxb:ToolBarControl ShowBackground="False" Grid.Row="0"  HorizontalAlignment="Stretch" 
                        VerticalAlignment="Top"
                        AllowCustomizationMenu="True" 
                        BarItemDisplayMode="ContentAndGlyph" UseWholeRow="True" 
                        AllowHide="False" AllowQuickCustomization="False" RotateWhenVertical="False">
        <dxb:ToolBarControl.Background>
            <LinearGradientBrush EndPoint="1,1"  StartPoint="0,0">
                <GradientStop Color="#a9546a" Offset="0.1" />
                <GradientStop Color="#b4506d" Offset="0.2" />
                <GradientStop Color="#9e3763" Offset="0.3" />
                <GradientStop Color="#ac4362" Offset="0.5" />
                <GradientStop Color="#8a3470" Offset="0.75" />
                <GradientStop Color="#753c83" Offset="1.0" />
            </LinearGradientBrush>
        </dxb:ToolBarControl.Background>
     </dxb:ToolBarControl>
4

1 回答 1

1

要更改 ToolBarControl 的背景,请覆盖BarControlThemeKey ResourceKey=BarTemplate资源。

xmlns:dxbt="http://schemas.devexpress.com/winfx/2008/xaml/bars/themekeys"
...
<Window.Resources>
    <ControlTemplate x:Key="{dxbt:BarControlThemeKey ResourceKey=BarTemplate, IsThemeIndependent=True}" TargetType="{x:Type ContentControl}">
        <Border x:Name="Background" Background="Red">
            <ContentPresenter/>
        </Border>
    </ControlTemplate>
</Window.Resources>

要了解有关自定义 DevExpress 资源的更多信息,请参阅如何查找和更改内部 DevExpress 控件模板

于 2017-06-13T08:15:21.243 回答