WPF 将TextBox更改为PasswordBox样式(文字显示方式为密码)

在TextBox样式中增加如下所诉:

        <Style x:Key="TxtPwd" TargetType="{x:Type TextBox}">
            <Setter Property="TextDecorations">
                <Setter.Value>
                    <TextDecorationCollection>
                        <TextDecoration>
                            <TextDecoration.Pen>
                                <Pen Thickness="10" Brush="Black"   EndLineCap="Round" StartLineCap="Round"     DashCap="Round"  >
                                    <Pen.DashStyle>
                                        <DashStyle Dashes="0.0,1.2" Offset="0.6"/>
                                    </Pen.DashStyle>
                                </Pen>
                            </TextDecoration.Pen>
                            <TextDecoration.Location>
                                <TextDecorationLocation>Strikethrough</TextDecorationLocation>
                            </TextDecoration.Location>
                        </TextDecoration>
                    </TextDecorationCollection>
                </Setter.Value>


            </Setter>
            <Setter Property="Height" Value="30"/>
            <Setter Property="Background" Value="#FF484D5E"></Setter>
            <Setter Property="Foreground" Value="Transparent"></Setter>
            <Setter Property="FontSize" Value="20"></Setter>
            <Setter Property="FontFamily" Value="Courier New"></Setter>
        </Style>

  

posted @ 2017-08-31 11:34  下路派出所  阅读(5766)  评论(0编辑  收藏  举报