zoukankan      html  css  js  c++  java
  • WPF资源使用

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        >
            <Style x:Key="EmptyButton" TargetType="Button">
                <Setter Property="Focusable" Value="False" />
                <Setter Property="IsTabStop" Value="False" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Grid Background="#00FF0000" Cursor="Hand">
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Disabled" />
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="MouseOver" />
                                        <VisualState x:Name="Pressed" />
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <ContentPresenter Content="{TemplateBinding Content}" 
                                                  ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
    </ResourceDictionary>

    重写Button

    然后在界面调用

        <UserControl.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="../Theme/EmptyButton.xaml" />
                </ResourceDictionary.MergedDictionaries>
           </ResourceDictionary>
        </UserControl.Resources>
  • 相关阅读:
    实现Bootstrap表格拖拽
    鼠标悬停显示气泡
    JS实现当前选择日期是星期几
    JS实现双击编辑可修改
    数组累计-reduce
    vuex——action,mutation,getters的调用
    正则 二
    常用正则 一
    vuex 的使用 mapState, mapGetters, mapMutations, mapActions
    正则替换所有的 ‘ / ’
  • 原文地址:https://www.cnblogs.com/w2011/p/3224948.html
Copyright © 2011-2022 走看看