全局 Style
1.定义一个全局资源文件,如下
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar" xmlns:local="clr-namespace:Haitai.Wpf"> <DataTemplate x:Key="MaskTemplate"> <Grid> <ContentControl Content="{Binding}"></ContentControl> <Grid Background="#3F000000"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <local:LoadingAdorner></local:LoadingAdorner> </StackPanel> </Grid> </Grid> </DataTemplate> <Style TargetType="dxb:BarManager"> <Setter Property="MDIMergeStyle" Value="Default"></Setter> <Setter Property="AllowCustomization" Value="False"></Setter> <Setter Property="AllowQuickCustomization" Value="False"></Setter> <Setter Property="AllowHotCustomization" Value="False"></Setter> </Style> <Style TargetType="dxb:Bar"> <Setter Property="ShowDragWidget" Value="False"></Setter> <Setter Property="AllowCustomizationMenu" Value="False"></Setter> <Setter Property="AllowQuickCustomization" Value="False"></Setter> <Setter Property="AllowHide" Value="False"></Setter> </Style> <Style TargetType="dxb:BarButtonItem"> <Setter Property="BarItemDisplayMode" Value="Default"></Setter> </Style> <Style x:Key="ShortButtonStyle" TargetType="Button"> <Setter Property="Width" Value="60"></Setter> <Setter Property="Margin" Value="0,0,4,0"></Setter> </Style> <Style x:Key="ButtonPanelStyle" TargetType="WrapPanel"> <Setter Property="Margin" Value="0,4,8,12"></Setter> <Setter Property="HorizontalAlignment" Value="Right"></Setter> </Style> <Style x:Key="WindowStyle" TargetType="Window"> <Setter Property="dx:ThemeManager.ThemeName" Value="None"></Setter> </Style> <Style x:Key="DialogStyle" TargetType="Window" BasedOn="{StaticResource ResourceKey=WindowStyle}"> <Setter Property="ResizeMode" Value="NoResize"></Setter> <Setter Property="SizeToContent" Value="Height"></Setter> </Style> <Style x:Key="ReadOnlyListViewStyle" TargetType="dxg:TreeListView"> <Setter Property="ShowRootIndent" Value="False"></Setter> <Setter Property="MultiSelectMode" Value="Row"></Setter> <Setter Property="AllowEditing" Value="False"></Setter> <Setter Property="NavigationStyle" Value="Row"></Setter> </Style> </ResourceDictionary>
2.使用
1)引入命名空间:
2)控件上使用