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,22 +121,30 @@
</Popup> </Popup>
</Grid> </Grid>
</Border> </Border>
<ItemsPresenter <LayoutTransformControl Grid.Row="1" RenderTransformOrigin="0.5,0">
Name="PART_ItemsPresenter" <ItemsPresenter
Grid.Row="1" Name="PART_ItemsPresenter"
Margin="0,4,0,0" Grid.Row="1"
VerticalAlignment="Top" Margin="0,4,0,0"
Grid.IsSharedSizeScope="True" Opacity="1"
ItemsPanel="{Binding ItemsPanel, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Top"
RenderTransformOrigin="0.5,0"> Grid.IsSharedSizeScope="True"
<ItemsPresenter.Transitions> ItemsPanel="{Binding ItemsPanel, RelativeSource={RelativeSource TemplatedParent}}"
RenderTransformOrigin="0.5,0">
<ItemsPresenter.Transitions>
<Transitions>
<DoubleTransition Easing="QuadraticEaseIn" Property="Height" Duration="0.25" />
<DoubleTransition Easing="QuadraticEaseOut" Property="Opacity" Duration="0.25" />
<TransformOperationsTransition Easing="QuadraticEaseInOut" Property="RenderTransform" Duration="0.25" />
</Transitions>
</ItemsPresenter.Transitions>
</ItemsPresenter>
<LayoutTransformControl.Transitions>
<Transitions> <Transitions>
<DoubleTransition Easing="QuadraticEaseIn" Property="Height" Duration="0.25" /> <TransformOperationsTransition Easing="QuadraticEaseInOut" Property="LayoutTransform" Duration="0.15" Delay="0.1" />
<DoubleTransition Easing="QuadraticEaseOut" Property="Opacity" Duration="0.25" />
<!-- <TransformOperationsTransition Easing="QuadraticEaseIn" Property="RenderTransform" Duration="0.25" /> -->
</Transitions> </Transitions>
</ItemsPresenter.Transitions> </LayoutTransformControl.Transitions>
</ItemsPresenter> </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)" />