feat: use LayoutTransformControl.

This commit is contained in:
Dong Bin
2025-02-13 18:23:46 +08:00
parent abd3e292c7
commit 3a1b2e97e4

View File

@@ -121,10 +121,12 @@
</Popup> </Popup>
</Grid> </Grid>
</Border> </Border>
<LayoutTransformControl Grid.Row="1" RenderTransformOrigin="0.5,0">
<ItemsPresenter <ItemsPresenter
Name="PART_ItemsPresenter" Name="PART_ItemsPresenter"
Grid.Row="1" Grid.Row="1"
Margin="0,4,0,0" Margin="0,4,0,0"
Opacity="1"
VerticalAlignment="Top" VerticalAlignment="Top"
Grid.IsSharedSizeScope="True" Grid.IsSharedSizeScope="True"
ItemsPanel="{Binding ItemsPanel, RelativeSource={RelativeSource TemplatedParent}}" ItemsPanel="{Binding ItemsPanel, RelativeSource={RelativeSource TemplatedParent}}"
@@ -133,10 +135,16 @@
<Transitions> <Transitions>
<DoubleTransition Easing="QuadraticEaseIn" Property="Height" Duration="0.25" /> <DoubleTransition Easing="QuadraticEaseIn" Property="Height" Duration="0.25" />
<DoubleTransition Easing="QuadraticEaseOut" Property="Opacity" Duration="0.25" /> <DoubleTransition Easing="QuadraticEaseOut" Property="Opacity" Duration="0.25" />
<!-- <TransformOperationsTransition Easing="QuadraticEaseIn" Property="RenderTransform" Duration="0.25" /> --> <TransformOperationsTransition Easing="QuadraticEaseInOut" Property="RenderTransform" Duration="0.25" />
</Transitions> </Transitions>
</ItemsPresenter.Transitions> </ItemsPresenter.Transitions>
</ItemsPresenter> </ItemsPresenter>
<LayoutTransformControl.Transitions>
<Transitions>
<TransformOperationsTransition Easing="QuadraticEaseInOut" Property="LayoutTransform" Duration="0.15" Delay="0.1" />
</Transitions>
</LayoutTransformControl.Transitions>
</LayoutTransformControl>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
<ControlTheme x:Key="{x:Type u:NavMenuItem}" TargetType="u:NavMenuItem"> <ControlTheme x:Key="{x:Type u:NavMenuItem}" TargetType="u:NavMenuItem">
@@ -159,7 +167,10 @@
<Style Selector="^:vertical-collapsed /template/ ItemsPresenter#PART_ItemsPresenter"> <Style Selector="^:vertical-collapsed /template/ ItemsPresenter#PART_ItemsPresenter">
<Setter Property="Height" Value="0" /> <Setter Property="Height" Value="0" />
<Setter Property="Opacity" Value="0" /> <Setter Property="Opacity" Value="0" />
<!-- <Setter Property="RenderTransform" Value="scale(1,0)" /> --> <!--<Setter Property="RenderTransform" Value="scale(1,0.9)" />-->
</Style>
<Style Selector="^:vertical-collapsed /template/ LayoutTransformControl">
<Setter Property="LayoutTransform" Value="scale(1,0)" />
</Style> </Style>
<Style Selector="^:vertical-collapsed /template/ PathIcon#PART_ExpanderIcon"> <Style Selector="^:vertical-collapsed /template/ PathIcon#PART_ExpanderIcon">
<Setter Property="RenderTransform" Value="rotate(180deg)" /> <Setter Property="RenderTransform" Value="rotate(180deg)" />