我想为我的一个元素禁用 EntrenceThemeAnimation。我有一个 Grid 将此动画设置为它的所有子项(我认为它是页面的默认设置)。是否可以为此网格的子级 ContentControl 禁用此动画?
我尝试了以下方法,但似乎不起作用。
内容
<Grid Style="{StaticResource LayoutRootStyle}">
...
<!-- no animations for this element -->
<ContentControl x:Name="Background" Content="Tabstagram" Margin="0" Grid.Row="1" Style="{StaticResource Background}">
<ContentControl.Transitions>
<TransitionCollection/>
</ContentControl.Transitions>
<ContentControl.ContentTransitions>
<TransitionCollection/>
</ContentControl.ContentTransitions>
</ContentControl>
风格
<Style x:Key="LayoutRootStyle" TargetType="Panel">
<Setter Property="Background" Value="{StaticResource ApplicationPageBackgroundThemeBrush}"/>
<Setter Property="ChildrenTransitions">
<Setter.Value>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="Background" TargetType="ContentControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContentControl">
<Grid>
<Grid.ChildrenTransitions>
<TransitionCollection/>
</Grid.ChildrenTransitions>
<Grid.Transitions>
<TransitionCollection/>
</Grid.Transitions>
<Rectangle IsHitTestVisible="False" StrokeThickness="75" Margin="0" Fill="#FFC1C1C1"/>