feat: fix active animation issue.
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
CornerRadius="2"
|
CornerRadius="2"
|
||||||
IsActive="{Binding #active.IsChecked}"
|
IsActive="{Binding #active.IsChecked}"
|
||||||
Loading="{Binding #loading.IsChecked}">
|
Loading="{Binding #loading.IsChecked}">
|
||||||
<TextBlock Margin="0,2" Text="是先有鸡还是先有蛋" />
|
<SelectableTextBlock Margin="0,2" Text="是先有鸡还是先有蛋" />
|
||||||
</u:Skeleton>
|
</u:Skeleton>
|
||||||
<u:Skeleton
|
<u:Skeleton
|
||||||
Margin="0,0,100,0"
|
Margin="0,0,100,0"
|
||||||
@@ -47,14 +47,14 @@
|
|||||||
CornerRadius="2"
|
CornerRadius="2"
|
||||||
IsActive="{Binding #active.IsChecked}"
|
IsActive="{Binding #active.IsChecked}"
|
||||||
Loading="{Binding #loading.IsChecked}">
|
Loading="{Binding #loading.IsChecked}">
|
||||||
<TextBlock Margin="0,2" Text="什么是工匠精神" />
|
<SelectableTextBlock Margin="0,2" Text="什么是工匠精神" />
|
||||||
</u:Skeleton>
|
</u:Skeleton>
|
||||||
<u:Skeleton
|
<u:Skeleton
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
CornerRadius="2"
|
CornerRadius="2"
|
||||||
IsActive="{Binding #active.IsChecked}"
|
IsActive="{Binding #active.IsChecked}"
|
||||||
Loading="{Binding #loading.IsChecked}">
|
Loading="{Binding #loading.IsChecked}">
|
||||||
<TextBlock Margin="0,2" Text="看山不是山,看水不是水,看山还是山,看水还是水" />
|
<SelectableTextBlock Margin="0,2" Text="看山不是山,看水不是水,看山还是山,看水还是水" />
|
||||||
</u:Skeleton>
|
</u:Skeleton>
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -25,33 +25,17 @@
|
|||||||
Content="{TemplateBinding Content}"
|
Content="{TemplateBinding Content}"
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||||
<Border
|
<Border
|
||||||
x:Name="PART_Border"
|
x:Name="PART_LoadingBorder"
|
||||||
Classes.Active="{Binding Path= IsActive, RelativeSource={RelativeSource TemplatedParent}}"
|
Classes.Active="{Binding Path= IsActive, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
IsHitTestVisible="{TemplateBinding Loading}"
|
IsHitTestVisible="{TemplateBinding Loading}"
|
||||||
|
Background="{DynamicResource SkeletonDefaultBackground}"
|
||||||
|
IsVisible="{TemplateBinding Loading}">
|
||||||
|
</Border>
|
||||||
|
<Border
|
||||||
|
x:Name="PART_ActiveBorder"
|
||||||
|
IsHitTestVisible="{TemplateBinding Loading}"
|
||||||
IsVisible="{TemplateBinding Loading}"
|
IsVisible="{TemplateBinding Loading}"
|
||||||
>
|
>
|
||||||
<Border.Styles>
|
|
||||||
<Style Selector="Border">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource SkeletonDefaultBackground}"></Setter>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Border.Active">
|
|
||||||
<Style.Animations>
|
|
||||||
<Animation
|
|
||||||
FillMode="None"
|
|
||||||
IterationCount="Infinite"
|
|
||||||
Easing="CubicEaseInOut"
|
|
||||||
PlaybackDirection="Alternate"
|
|
||||||
Duration="0:0:1.4">
|
|
||||||
<KeyFrame Cue="0%">
|
|
||||||
<Setter Property="Border.Background" Value="{DynamicResource SkeletonStartAnimationBackground}" />
|
|
||||||
</KeyFrame>
|
|
||||||
<KeyFrame Cue="100%">
|
|
||||||
<Setter Property="Border.Background" Value="{DynamicResource SkeletonEndAnimationBackground}" />
|
|
||||||
</KeyFrame>
|
|
||||||
</Animation>
|
|
||||||
</Style.Animations>
|
|
||||||
</Style>
|
|
||||||
</Border.Styles>
|
|
||||||
</Border>
|
</Border>
|
||||||
</Panel>
|
</Panel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
28
src/Ursa.Themes.Semi/Styles/Skeleton.axaml
Normal file
28
src/Ursa.Themes.Semi/Styles/Skeleton.axaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<Styles xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:u="https://irihi.tech/ursa">
|
||||||
|
<Design.PreviewWith>
|
||||||
|
<Border Padding="20">
|
||||||
|
<!-- Add Controls for Previewer Here -->
|
||||||
|
</Border>
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
|
<!-- Add Styles Here -->
|
||||||
|
<Style Selector="u|Skeleton[IsActive=True][Loading=True] /template/ Border#PART_ActiveBorder">
|
||||||
|
<Style.Animations>
|
||||||
|
<Animation
|
||||||
|
FillMode="None"
|
||||||
|
IterationCount="Infinite"
|
||||||
|
Easing="CubicEaseInOut"
|
||||||
|
PlaybackDirection="Alternate"
|
||||||
|
Duration="0:0:1.4">
|
||||||
|
<KeyFrame Cue="0%">
|
||||||
|
<Setter Property="Border.Background" Value="{DynamicResource SkeletonStartAnimationBackground}" />
|
||||||
|
</KeyFrame>
|
||||||
|
<KeyFrame Cue="100%">
|
||||||
|
<Setter Property="Border.Background" Value="{DynamicResource SkeletonEndAnimationBackground}" />
|
||||||
|
</KeyFrame>
|
||||||
|
</Animation>
|
||||||
|
</Style.Animations>
|
||||||
|
</Style>
|
||||||
|
</Styles>
|
||||||
@@ -5,5 +5,6 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
<StyleInclude Source="ButtonGroup.axaml" />
|
<StyleInclude Source="ButtonGroup.axaml" />
|
||||||
|
<StyleInclude Source="Skeleton.axaml" />
|
||||||
<!-- Add Styles Here -->
|
<!-- Add Styles Here -->
|
||||||
</Styles>
|
</Styles>
|
||||||
|
|||||||
Reference in New Issue
Block a user