• 控件模板 1


    简单的使用控件模板

    <Button FontSize="15" HorizontalAlignment="Center" Content="Hello" Width="120" Height="30">
                <Button.Template>
                    <ControlTemplate>
                        <Grid>
                            <Rectangle Fill="Red" RadiusX="15" RadiusY="15"/>
                            <TextBlock Name="textBlock" Margin="{TemplateBinding Button.Padding}" VerticalAlignment="Center"
                                        HorizontalAlignment="Center" Text="{TemplateBinding Button.Content}"/>
                        </Grid>
                    </ControlTemplate>
                </Button.Template>
            </Button>

    使用资源

    <Window.Resources>
            <ControlTemplate x:Key="buttontemplate" TargetType="{x:Type Button}">
                <Border BorderBrush="Orange" BorderThickness="4" CornerRadius="3"
                        Background="Red" TextBlock.Foreground="Black" Margin="30">
                    <ContentPresenter RecognizesAccessKey="True" HorizontalAlignment="Center"
                                       VerticalAlignment="Center"></ContentPresenter>
                </Border>
            </ControlTemplate>
        </Window.Resources>
        <StackPanel>
            <Button FontSize="15" Template="{StaticResource ResourceKey=buttontemplate}" Content="Hello">
            </Button>
        </StackPanel>

  • 相关阅读:
    Mycat 安全设置
    基于 HA 机制的 Mycat 高可用
    mycat中间件进行MySQL数据表的水平拆分
    mycat中间件进行MySQL数据库的垂直拆分
    mycat中间件进行MySQL的数据读写分离
    dubbo环境搭建--Windows
    分布式应用架构的发展演变RPC
    Java新特性--方法引用
    Java新特性-stream流
    Java新特性-四大函数式接口
  • 原文地址:https://www.cnblogs.com/KimhillZhang/p/2422476.html
Copyright © 2020-2023  润新知