예제 #1
0
        private void MainGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var    item          = MainGrid.SelectedItem;
            var    itemContainer = MainGrid.ContainerFromItem(item);
            Visual visual;

            Rectangle rect = FindElementInVisualTree <Rectangle>(itemContainer);

            visual = ElementCompositionPreview.GetElementVisual(rect);


            var growAnim = visual.Compositor.CreateVector3KeyFrameAnimation();

            growAnim.InsertKeyFrame(0.6f, new Vector3(x: 6f, y: 4f, z: 4f));
            growAnim.InsertKeyFrame(1.0f, new Vector3(x: 1f, y: 1f, z: 1f));
            growAnim.Duration = TimeSpan.FromMilliseconds(2000);

            visual.StartAnimation("Scale", growAnim);
        }