浏览代码

fix: Expander header icon flip when collapsing or expanding canceled (#13780)

memorydream 1 年之前
父节点
当前提交
208e5403e4
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      src/Avalonia.Themes.Fluent/Controls/Expander.xaml

+ 7 - 2
src/Avalonia.Themes.Fluent/Controls/Expander.xaml

@@ -115,7 +115,7 @@
       </ControlTemplate>
       </ControlTemplate>
     </Setter>
     </Setter>
 
 
-    <Style Selector="^:checked /template/ Path#ExpandCollapseChevron">
+    <Style Selector="^[Tag=expanded] /template/ Path#ExpandCollapseChevron">
       <Style.Animations>
       <Style.Animations>
         <Animation FillMode="Both" Duration="0:0:0.0625">
         <Animation FillMode="Both" Duration="0:0:0.0625">
           <KeyFrame Cue="100%">
           <KeyFrame Cue="100%">
@@ -125,7 +125,7 @@
       </Style.Animations>
       </Style.Animations>
     </Style>
     </Style>
 
 
-    <Style Selector="^:not(:checked) /template/ Path#ExpandCollapseChevron">
+    <Style Selector="^[Tag=collapsed] /template/ Path#ExpandCollapseChevron">
       <Style.Animations>
       <Style.Animations>
         <Animation FillMode="Both" Duration="0:0:0.0625">
         <Animation FillMode="Both" Duration="0:0:0.0625">
           <KeyFrame Cue="0%">
           <KeyFrame Cue="0%">
@@ -262,8 +262,13 @@
       <Setter Property="VerticalAlignment" Value="Stretch" />
       <Setter Property="VerticalAlignment" Value="Stretch" />
     </Style>
     </Style>
 
 
+    <Style Selector="^:expanded /template/ ToggleButton#ExpanderHeader">
+      <Setter Property="Tag" Value="expanded" />
+    </Style>
+
     <Style Selector="^:not(:expanded) /template/ ToggleButton#ExpanderHeader">
     <Style Selector="^:not(:expanded) /template/ ToggleButton#ExpanderHeader">
       <Setter Property="CornerRadius" Value="{Binding $parent[Expander].CornerRadius}" />
       <Setter Property="CornerRadius" Value="{Binding $parent[Expander].CornerRadius}" />
+      <Setter Property="Tag" Value="collapsed" />
     </Style>
     </Style>
     <Style Selector="^:expanded:up /template/ ToggleButton#ExpanderHeader">
     <Style Selector="^:expanded:up /template/ ToggleButton#ExpanderHeader">
       <Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius, Converter={StaticResource BottomCornerRadiusFilterConverter}}" />
       <Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius, Converter={StaticResource BottomCornerRadiusFilterConverter}}" />