This commit is contained in:
NaBian committed 2019-11-02 10:23:27 +08:00
1 parent 638b5311bf
commit fdadb2c2cb
2 files changed
+6 -13

No files matched your search

@@ -12,8 +12,6 @@ namespace HandyControl.Controls
{ {
public class AnimationPath : Shape public class AnimationPath : Shape
{ {
private bool _isLoaded;
/// <summary> /// <summary>
/// 故事板 /// 故事板
/// </summary> /// </summary>
@@ -126,15 +124,7 @@ namespace HandyControl.Controls
OnPropertiesChanged)); OnPropertiesChanged));
} }
public AnimationPath() public AnimationPath() => Loaded += (s, e) => UpdatePath();
{
Loaded += (s, e) =>
{
if (_isLoaded) return;
UpdatePath();
_isLoaded = true;
};
}
/// <summary> /// <summary>
/// 动画完成事件 /// 动画完成事件
@@ -142,8 +142,11 @@
<TextBlock Margin="0,10,0,0" Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}"/> <TextBlock Margin="0,10,0,0" Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}"/>
</StackPanel> </StackPanel>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded"> <EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="PART_Wave">
<BeginStoryboard Storyboard="{StaticResource StoryboardOnLoaded}"/> <BeginStoryboard Name="BeginStoryboardWave" Storyboard="{StaticResource StoryboardOnLoaded}"/>
</EventTrigger>
<EventTrigger RoutedEvent="FrameworkElement.Unloaded" SourceName="PART_Wave">
<StopStoryboard BeginStoryboardName="BeginStoryboardWave"/>
</EventTrigger> </EventTrigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>