I want to add placeholder to a password box i have achived that uptp some extent but the problem is that when i type the password, then the watermark text remains there like the image attached below:
- <Border Margin="0,0,0,10" Grid.Column="0" Grid.Row="4" CornerRadius="7" BorderThickness="1" Grid.ColumnSpan="2" BorderBrush="Gray">
- <PasswordBox Grid.Row="1" Margin="3,1,1,1" Grid.Column="1" x:Name="txtConfirmPassword" BorderThickness="0,0,0,0" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" Height="35" >
- <PasswordBox.Style>
- <Style xmlns:sys="clr-namespace:System;assembly=mscorlib" TargetType="{x:Type PasswordBox}">
- <Style.Resources>
- <VisualBrush x:Key="CueBannerBrush" AlignmentX="Left" Stretch="None">
- <VisualBrush.Visual>
- <Label Content="Confirm Password" Foreground="Gray" Padding="10"/>
- </VisualBrush.Visual>
- </VisualBrush>
- </Style.Resources>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Password}" Value="{x:Null}">
- <Setter Property="Background" Value="{StaticResource CueBannerBrush}" />
- </DataTrigger>
- <Trigger Property="IsKeyboardFocused" Value="True">
- <Setter Property="Background" Value="White"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- </PasswordBox.Style>
- </PasswordBox>
- </Border>