你的位置:首页 > ASP.net教程

[ASP.net教程]WPF常用资源


 

TextBoxErrorToolipStyle <Style x:Key="ControlBaseStyle" TargetType="{x:Type Control}">    <Style.Triggers>      <MultiTrigger>        <MultiTrigger.Conditions>          <Condition Property="Control.IsEnabled" Value="False"/>          <Condition Property="Control.IsHitTestVisible" Value="True"/>        </MultiTrigger.Conditions>        <Setter Property="Control.Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />      </MultiTrigger>    </Style.Triggers>  </Style> <Style x:Key="TextBoxErrorToolTipStyle" TargetType="{x:Type Control}" BasedOn="{StaticResource ControlBaseStyle}">    <Style.Setters>      <Setter Property="Control.ContextMenu" Value="{StaticResource TextBoxContextMenu}" />      <Setter Property="Control.HorizontalAlignment" Value="Stretch"/>      <Setter Property="Control.VerticalAlignment" Value="Center"/>      <Setter Property="Control.Margin" Value="3,3"/>    </Style.Setters>    <Style.Triggers>      <MultiTrigger>        <MultiTrigger.Conditions>          <Condition Property="Validation.HasError" Value="True" />          <Condition Property="IsEnabled" Value="True" />        </MultiTrigger.Conditions>        <Setter Property="ToolTip"                  Value="{Binding RelativeSource={RelativeSource Self},                  Path=(Validation.Errors).CurrentItem.ErrorContent}"/>        <Setter Property="Validation.ErrorTemplate"             Value="{DynamicResource ValidationErrorTemplate}"/>      </MultiTrigger>    </Style.Triggers>      </Style><ControlTemplate x:Key="ValidationErrorTemplate">    <DockPanel LastChildFill="True">      <Border BorderBrush="Red" BorderThickness="1">        <AdornedElementPlaceholder Name="rangeErrorAdorner" Margin="-1,-1" />      </Border>    </DockPanel>  </ControlTemplate>