• WPF学习记录 三、控件模版


    可以给控件增加模版样式

    如下就把一个按钮,完成变成了其它的样式:

        <Window.Resources>
            <ControlTemplate  x:Key="myTemplate" TargetType="Button">
                <Border Background="Red" CornerRadius="5">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <TextBlock Text="$" VerticalAlignment="Center"></TextBlock>
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}"></ContentPresenter>
                    </StackPanel>
                </Border>
            </ControlTemplate>
        </Window.Resources>
        <Grid>
            <DockPanel  LastChildFill="False">
                <Button DockPanel.Dock="Left" Height="50" Width="100" Template="{StaticResource myTemplate}" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="确定"></Button>
            </DockPanel>
        </Grid>

  • 相关阅读:
    大白话五种IO模型
    test
    shutil模块(了解)
    isinstance和issubclass
    变量的三个特征
    匿名函数
    javascript location 对象
    select元素javascript常用操作
    设置mysql的用户权限
    jquery
  • 原文地址:https://www.cnblogs.com/wjx-blog/p/15423550.html
Copyright © 2020-2023  润新知