• Button虚线边框


    <Window.Resources>
            <Style TargetType="Button">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid>
                                <Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" BorderThickness="1">
                                    <Border.BorderBrush>
                                        <!--MappingMode:1.Absolute,StartPoint和EndPoint的值是按照Border的实际大小进行坐标设置
                                        2.RelativeToBoundingBox,StartPoint和EndPoint的值按照0,0和0,1进行设置
                                        -->
                                        <LinearGradientBrush StartPoint="0,5" EndPoint="5,0" SpreadMethod="Repeat" MappingMode="Absolute">
                                            <GradientStop Color="Red" Offset="0" />
                                            <GradientStop Color="Transparent" Offset="0.5" />
                                            <GradientStop Color="Red" Offset="1" />
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                </Border>
    <!--此方法也能显示文字   <ContentPresenter Content="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" />-->
                                <TextBlock Text="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                            </Grid>                        
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Window.Resources>
        <Grid Name="grdRoot">
            <Button Name="btnClick" Content="Click" Width="72" Height="24"  />                    
        </Grid>
  • 相关阅读:
    文学-人物-苏轼:百科
    文学-人物:王维
    文学-人物:杜甫
    文学-人物:李白
    模型-CMM:百科
    公司-魏桥:百科
    云:VMware
    postfix
    CSS 实现背景图尺寸不随浏览器缩放而变化
    Java中线程的操作状态
  • 原文地址:https://www.cnblogs.com/kelei12399/p/2598911.html
Copyright © 2020-2023  润新知