<Canvas x:Name="MainPageCanvas">
<ItemsControl x:Name="itemsControl" ItemsSource="{Binding Items}" RenderTransformOrigin="0.5,0.5">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Canvas x:Name="MainPageCanvas2">
<TextBlock x:Name="MainPageTextBox" Text="{Binding LineThree}" Canvas.Left="{Binding LineOne}" Canvas.Top="{Binding LineTwo}" FontSize="32" >
</TextBlock>
<TextBlock x:Name="MainPageTextBox2" Text="{Binding LineFour}" Canvas.Left="{Binding LineOne}" Canvas.Top="{Binding LineTwo}" FontSize="32"/>
</Canvas>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Canvas>
如何将动画应用于项目中的文本块控件和动画应基于事件开始
答案 0 :(得分:0)
当Pivot控件从一个项目移动到下一个项目时,请在列表中查看此blog post I wrote on re-creating the metro-style sliding of elements。
您需要找到承载模板创建的Canvas元素的容器。然后迭代那些可见的,应用你的动画:
// locate the stack panel that hosts the items
VirtualizingStackPanel vsp = list.Descendants<VirtualizingStackPanel>().First()
as VirtualizingStackPanel;
// iterate over each of the items in view
int firstVisibleItem = (int)vsp.VerticalOffset;
int visibleItemCount = (int)vsp.ViewportHeight;
for (int index = firstVisibleItem; index <= firstVisibleItem + visibleItemCount; index++)
{
var lbi = list.ItemContainerGenerator.ContainerFromIndex(index);
if (lbi == null)
continue;
// add your animation here!
};