I'm trying to implement placeholder text for PasswordBox by following code:
<PasswordBox x:Name="passwordText"/>
<TextBlock IsHitTestVisible="False" Text="Password">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Password, ElementName=passwordText}" Value="">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
Here's the result:
So, is there something wrong with the code above?
BTW, I tried it with TextBox instead of PasswordBox and it worked just as expected.