这是我的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>
答案 0 :(得分: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资源的详情,请参阅How to find and change an inner DevExpress control template