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>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM