private void AnimateEntry(Size targetSize)
        {
            var svi = GuiHelpers.GetParentObject <ScatterViewItem>(this, false);

            if (svi != null)
            {
                // Easing function provide a more natural animation
                IEasingFunction ease = new BackEase {
                    EasingMode = EasingMode.EaseOut, Amplitude = 0.3
                };
                var duration = new Duration(TimeSpan.FromMilliseconds(500));
                var w        = new DoubleAnimation(0.0, targetSize.Width, duration)
                {
                    EasingFunction = ease
                };
                var h = new DoubleAnimation(0.0, targetSize.Height, duration)
                {
                    EasingFunction = ease
                };
                var o = new DoubleAnimation(0.0, 1.0, duration);

                // Remove the animation after it has completed so that its possible to manually resize the scatterviewitem
                w.Completed += (s, e) => svi.BeginAnimation(ScatterViewItem.WidthProperty, null);
                h.Completed += (s, e) => svi.BeginAnimation(ScatterViewItem.HeightProperty, null);
                // Set the size manually, otherwise once the animation is removed the size will revert back to the minimum size
                // Since animation has higher priority for DP's, this setting won't have effect until the animation is removed
                svi.Width  = targetSize.Width;
                svi.Height = targetSize.Height;

                svi.BeginAnimation(ScatterViewItem.WidthProperty, w);
                svi.BeginAnimation(ScatterViewItem.HeightProperty, h);
                svi.BeginAnimation(ScatterViewItem.OpacityProperty, o);
            }
        }
        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            var sv = GuiHelpers.GetParentObject <ScatterView>(this);

            if (sv != null)
            {
                sv.Items.Remove(this);
            }
        }
        private void AnimateExit()
        {
            var svi = GuiHelpers.GetParentObject <ScatterViewItem>(this, false);

            if (svi != null)
            {
                IEasingFunction ease = new BackEase {
                    EasingMode = EasingMode.EaseOut, Amplitude = 0.3
                };
                var duration = new Duration(TimeSpan.FromMilliseconds(500));
                var w        = new DoubleAnimation(0.0, duration)
                {
                    EasingFunction = ease
                };
                var h = new DoubleAnimation(0.0, duration)
                {
                    EasingFunction = ease
                };
                var o = new DoubleAnimation(0.0, duration);
                svi.BeginAnimation(ScatterViewItem.WidthProperty, w);
                svi.BeginAnimation(ScatterViewItem.HeightProperty, h);
                svi.BeginAnimation(ScatterViewItem.OpacityProperty, o);
            }
        }