mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
optimize<TextBox>: lag for validation error panel
This commit is contained in:
parent
add6062917
commit
8d5f594815
1 changed files with 30 additions and 73 deletions
|
@ -1,78 +1,6 @@
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls">
|
||||||
<ControlTemplate x:Key="Template.Validation.Tooltip" TargetType="{x:Type ToolTip}">
|
|
||||||
<Border x:Name="Root" Margin="5,0,0,0" Opacity="0" Padding="0,0,20,20" RenderTransformOrigin="0,0">
|
|
||||||
<Border.RenderTransform>
|
|
||||||
<TranslateTransform x:Name="xform" X="-25" />
|
|
||||||
</Border.RenderTransform>
|
|
||||||
|
|
||||||
<Border.Effect>
|
|
||||||
<DropShadowEffect BlurRadius="11" ShadowDepth="6" Opacity="0.4" />
|
|
||||||
</Border.Effect>
|
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="OpenStates">
|
|
||||||
<VisualStateGroup.Transitions>
|
|
||||||
<VisualTransition GeneratedDuration="0" />
|
|
||||||
<VisualTransition GeneratedDuration="0:0:0.2" To="Open">
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
|
|
||||||
<DoubleAnimation.EasingFunction>
|
|
||||||
<BackEase Amplitude=".3" EasingMode="EaseOut" />
|
|
||||||
</DoubleAnimation.EasingFunction>
|
|
||||||
</DoubleAnimation>
|
|
||||||
<DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root" />
|
|
||||||
</Storyboard>
|
|
||||||
</VisualTransition>
|
|
||||||
</VisualStateGroup.Transitions>
|
|
||||||
<VisualState x:Name="Closed">
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root" />
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Open">
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X" Storyboard.TargetName="xform" />
|
|
||||||
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root" />
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
</VisualStateGroup>
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
|
|
||||||
<Border Background="#FFDC000C" BorderThickness="1" BorderBrush="#FFBC000C">
|
|
||||||
<TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap" Text="{Binding [0].ErrorContent}" UseLayoutRounding="false" />
|
|
||||||
</Border>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
|
|
||||||
<ControlTemplate x:Key="Template.Validation.Error">
|
|
||||||
<AdornedElementPlaceholder x:Name="Target">
|
|
||||||
<Border BorderBrush="#FFDB000C" BorderThickness="1" x:Name="root">
|
|
||||||
<ToolTipService.ToolTip>
|
|
||||||
<ToolTip x:Name="validationTooltip"
|
|
||||||
Placement="Right"
|
|
||||||
PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
|
|
||||||
Template="{StaticResource Template.Validation.Tooltip}"
|
|
||||||
Style="{x:Null}"/>
|
|
||||||
</ToolTipService.ToolTip>
|
|
||||||
<Grid Background="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top">
|
|
||||||
<Path Width="10" Height="10" Data="M 1,0 L8,0 L8,7 z" Fill="#FFDC000C"/>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</AdornedElementPlaceholder>
|
|
||||||
|
|
||||||
<ControlTemplate.Triggers>
|
|
||||||
<MultiDataTrigger>
|
|
||||||
<MultiDataTrigger.Conditions>
|
|
||||||
<Condition Binding="{Binding ElementName=Target, Path=AdornedElement.IsKeyboardFocusWithin, Mode=OneWay}" Value="True" />
|
|
||||||
<Condition Binding="{Binding ElementName=Target, Path=AdornedElement.(Validation.HasError), Mode=OneWay}" Value="True" />
|
|
||||||
</MultiDataTrigger.Conditions>
|
|
||||||
<Setter TargetName="validationTooltip" Property="IsOpen" Value="True"/>
|
|
||||||
</MultiDataTrigger>
|
|
||||||
</ControlTemplate.Triggers>
|
|
||||||
</ControlTemplate>
|
|
||||||
|
|
||||||
<Style x:Key="Style.TextBox" TargetType="{x:Type TextBox}">
|
<Style x:Key="Style.TextBox" TargetType="{x:Type TextBox}">
|
||||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||||
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||||||
|
@ -84,7 +12,6 @@
|
||||||
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border1}"/>
|
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border1}"/>
|
||||||
<Setter Property="BorderThickness" Value="1"/>
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource Template.Validation.Error}"/>
|
|
||||||
<Setter Property="ContextMenu">
|
<Setter Property="ContextMenu">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
|
@ -94,6 +21,36 @@
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
<Setter Property="Validation.ErrorTemplate">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<AdornedElementPlaceholder x:Name="Target">
|
||||||
|
<Border x:Name="Border" BorderBrush="#FFDB000C" BorderThickness="1">
|
||||||
|
<Grid Background="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top">
|
||||||
|
<Path Width="10" Height="10" Data="M 1,0 L8,0 L8,7 z" Fill="#FFDC000C"/>
|
||||||
|
<Popup x:Name="Tips" IsOpen="False" Placement="Right" PlacementTarget="{Binding ElementName=Border}" AllowsTransparency="True">
|
||||||
|
<Border Background="Transparent" Height="24">
|
||||||
|
<Border Background="#FFDB000C" Margin="4,0">
|
||||||
|
<TextBlock Foreground="White" Margin="12,0" VerticalAlignment="Center" Text="{Binding [0].ErrorContent}"/>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
</Popup>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</AdornedElementPlaceholder>
|
||||||
|
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<MultiDataTrigger>
|
||||||
|
<MultiDataTrigger.Conditions>
|
||||||
|
<Condition Binding="{Binding ElementName=Target, Path=AdornedElement.IsKeyboardFocusWithin, Mode=OneWay}" Value="True" />
|
||||||
|
<Condition Binding="{Binding ElementName=Target, Path=AdornedElement.(Validation.HasError), Mode=OneWay}" Value="True" />
|
||||||
|
</MultiDataTrigger.Conditions>
|
||||||
|
<Setter TargetName="Tips" Property="IsOpen" Value="True"/>
|
||||||
|
</MultiDataTrigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||||
|
|
Loading…
Reference in a new issue