(WPF)实现DataGrid中当某一列的值显示为密码样式
<!--变量值-->
<DataGridTextColumn Binding="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,
NotifyOnTargetUpdated=True}" Header="变量值">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Type,UpdateSourceTrigger=PropertyChanged}" Value="{x:Static RpaModelVariable:ValueTypeConstants.Password}">
<Setter Property="Foreground" Value="Transparent"/>
<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>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.ElementStyle>
浙公网安备 33010602011771号