PasswordBox with round corner???
Hi!
is it possible to have rounded corner in a PasswordBox?? I search to make it in blend but don't find the property that allows me to do that....
Here is a copy of the PasswordBox style :
Code Snippet<Style x:Key="PasswordBoxStyle1" TargetType="{x:Type PasswordBox}">
<Setter Property="FontFamily" Value="/Resources/#EUROSTILE"/>
<Setter Property="PasswordChar" Value="●"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Microsoft_Windows_Themes:ListBoxChrome SnapsToDevicePixels="true" x:Name="Bd" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1" OpacityMask="{x:Null}">
<ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ContentHost" Template="{DynamicResource ScrollViewerControlTemplate1}"/>
</Microsoft_Windows_Themes:ListBoxChrome>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>Thx for help ;-)
++
Answers
- if this is a Border [ Microsoft_Windows_Themes:ListBoxChrome ] , you should be able to set the CornerRadius property on it..
This style if working for me
Code Snippet<
Style TargetType="PasswordBox"><
Setter Property="PasswordChar" Value="●"/><
Setter Property="KeyboardNavigation.TabNavigation" Value="None"/><
Setter Property="BorderThickness" Value="1"/><
Setter Property="HorizontalContentAlignment" Value="Left"/><
Setter Property="Padding" Value="1"/><
Setter Property="FocusVisualStyle" Value="{x:Null}"/><
Setter Property="AllowDrop" Value="true"/><
Setter Property="Template"><
Setter.Value><
ControlTemplate TargetType="PasswordBox"><
Border CornerRadius="5" x:Name="Bd" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="Black" BorderThickness="1" OpacityMask="{x:Null}"><
ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ContentHost" Template="{DynamicResource ScrollViewerControlTemplate1}"/></
Border><
ControlTemplate.Triggers><
Trigger Property="IsEnabled" Value="false"><
Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/><
Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/></
Trigger></
ControlTemplate.Triggers></
ControlTemplate></
Setter.Value></
Setter></
Style>I don't know what [ Microsoft_Windows_Themes:ListBoxChrome ] is... but I change it with Border and I can yet set CornerRadius on it
.Thanks for your fast answers.
++
All Replies
- if this is a Border [ Microsoft_Windows_Themes:ListBoxChrome ] , you should be able to set the CornerRadius property on it..
This style if working for me
Code Snippet<
Style TargetType="PasswordBox"><
Setter Property="PasswordChar" Value="●"/><
Setter Property="KeyboardNavigation.TabNavigation" Value="None"/><
Setter Property="BorderThickness" Value="1"/><
Setter Property="HorizontalContentAlignment" Value="Left"/><
Setter Property="Padding" Value="1"/><
Setter Property="FocusVisualStyle" Value="{x:Null}"/><
Setter Property="AllowDrop" Value="true"/><
Setter Property="Template"><
Setter.Value><
ControlTemplate TargetType="PasswordBox"><
Border CornerRadius="5" x:Name="Bd" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="Black" BorderThickness="1" OpacityMask="{x:Null}"><
ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ContentHost" Template="{DynamicResource ScrollViewerControlTemplate1}"/></
Border><
ControlTemplate.Triggers><
Trigger Property="IsEnabled" Value="false"><
Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/><
Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/></
Trigger></
ControlTemplate.Triggers></
ControlTemplate></
Setter.Value></
Setter></
Style>I don't know what [ Microsoft_Windows_Themes:ListBoxChrome ] is... but I change it with Border and I can yet set CornerRadius on it
.Thanks for your fast answers.
++re
do you know how I can make an effect like in InfoTextBox (Microsoft.Samples.KMoore.WPFSamples.InfoTextBox) ?
--> a text like "Enter a password here..." in the passwordbox and when the user start to enter text in the passwordbox, this text disappear...
I tried with trigger, but it doesn't work...

thxxx
- Couldn't you just put a label control over top of the content and then set a trigger to fade it out?
GC wrote: Couldn't you just put a label control over top of the content and then set a trigger to fade it out? yes, I already tried it, but what event should I use to fade it out and remove the effect?

