标签:style blog http color os io ar for art
原因也很直接,老板需要,一开始为TextBox发愁,就找了这个控件凑合用,至于版权什么的,内部工具也不卖钱,而且我不懂英文,也就无视了:
1 <Style x:Key="PasswordBoxStyle1" TargetType="{x:Type PasswordBox}"> 2 <Setter Property="BorderThickness" Value="1"/> 3 <Setter Property="Padding" Value="2"/> 4 <Setter Property="Template"> 5 <Setter.Value> 6 <ControlTemplate TargetType="{x:Type PasswordBox}"> 7 <Border x:Name="Bd" SnapsToDevicePixels="true" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"> 8 <Grid Margin="{TemplateBinding Padding}"> 9 <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> 10 <TextBlock x:Name="water" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="LightGray" FontSize="{TemplateBinding FontSize}" 11 Text="请输入密码" Visibility="Hidden"/> 12 </Grid> 13 </Border> 14 15 <ControlTemplate.Triggers> 16 <Trigger Property="IsEnabled" Value="false"> 17 <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/> 18 <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> 19 </Trigger> 20 <MultiTrigger> 21 <MultiTrigger.Conditions> 22 <Condition Property="IsFocused" Value="false"/> 23 <Condition Property="ExtentWidth" Value="0" SourceName="PART_ContentHost"/> 24 </MultiTrigger.Conditions> 25 <Setter Property="Visibility" Value="Visible" TargetName="water"/> 26 </MultiTrigger> 27 </ControlTemplate.Triggers> 28 </ControlTemplate> 29 </Setter.Value> 30 </Setter> 31 </Style>
标签:style blog http color os io ar for art
原文地址:http://www.cnblogs.com/3Tai/p/3956505.html