首页 > 其他 > 详细

全局 Style

时间:2014-01-24 07:05:42      阅读:446      评论:0      收藏:0      [点我收藏+]

1.定义一个全局资源文件,如下

bubuko.com,布布扣
<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>
bubuko.com,布布扣

2.使用
1)引入命名空间:

bubuko.com,布布扣

 

2)控件上使用

bubuko.com,布布扣

全局 Style

原文:http://www.cnblogs.com/quietwalk/p/3531655.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!