private void RemoveTweetItemControl(TweetItemControl tic, TweetsPanelLayoutMode mode, Storyboard sb) { recycleTweetControls.Add(tic); tweetControls.Remove(tic); switch (mode) { case TweetsPanelLayoutMode.Left: case TweetsPanelLayoutMode.Relayout: // 右に押し出す { DoubleAnimation da = new DoubleAnimation() { To = (double)tic.GetValue(Canvas.LeftProperty) + ActualWidth, Duration = moveDuration, EasingFunction = moveEasing, }; da.Completed += (sender, e) => { LayoutRoot.Children.Remove(tic); }; Storyboard.SetTarget(da, tic); Storyboard.SetTargetProperty(da, canvasLeftPropertyPath); sb.Children.Add(da); } break; case TweetsPanelLayoutMode.Right: { DoubleAnimation da = new DoubleAnimation() { To = (double)tic.GetValue(Canvas.LeftProperty) - ActualWidth, Duration = moveDuration, EasingFunction = moveEasing, }; da.Completed += (sender, e) => { LayoutRoot.Children.Remove(tic); }; Storyboard.SetTarget(da, tic); Storyboard.SetTargetProperty(da, canvasLeftPropertyPath); sb.Children.Add(da); } break; default: // すぐ消す LayoutRoot.Children.Remove(tic); break; } }
private void addTweet(Tweet tweet) { TweetItemControl t = new TweetItemControl(); t.Tweet = tweet; tweetControls.Add(t); LayoutRoot.Children.Add(t); }