Jus*_*les 3 xaml microsoft-metro windows-8 windows-runtime windows-store-apps
我正在应用EntranceThemeTransition动画TextBlock.该TextBlock具有的风格PageHeaderTextStyle具有RenderTransform它.我遇到的问题是,在动画完成播放之前,RenderTransform应用的Translation效果实际上不会呈现.因此,它看起来很奇怪,因为动画会滚动控件,然后突然翻译将文本捕捉到位.有谁知道为什么会这样?
有没有办法在考虑翻译的情况下播放动画?
转变:
<Setter Property="RenderTransform">
<Setter.Value>
<TranslateTransform X="-2" Y="8"/>
</Setter.Value>
</Setter>
Run Code Online (Sandbox Code Playgroud)
TextBlock的:
<TextBlock x:Name="pageTitle" Grid.Column="1" Text="{Binding Title}" Style="{StaticResource PageHeaderTextStyle}">
<TextBlock.Transitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</TextBlock.Transitions>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
我刚刚遇到了完全相同的问题.解决问题的方法是将一个级别与其上的过渡区域嵌套,例如使用TextBlock一个级别.GridGrid
发生的变化是转换将变换应用于其每个子节点,但是它们可能具有的任何变换都会暂时替换,直到动画完成后,在之后应用原始变换时会导致讨厌的"捕捉".
在下面的示例中,将运行转换,替换TextBlock's变换,然后在转换结束后将应用原始变换.你看到'snap':
<Grid Style="{StaticResource LayoutRootStyle}">
<TextBlock Text="Header" Style="{StaticResource PageHeaderTextStyle}"
Margin="0,0,0,40"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
在下一个示例中,转换运行并将转换应用于Grid,使得TextBlock转换不受影响.没有'快照':
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid>
<TextBlock Text="Header" Style="{StaticResource PageHeaderTextStyle}"
Margin="0,0,0,40"/>
</Grid>
</Grid>
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!