Make UserControl "slide" from the side of the screen?

I am using the following code to inject a view into a Grid:

private void OnShowNotesRequested(UserControl view)
        {
            if (view == null) throw new NotSupportedException("View should not be null");

            // Skip first GridRow - this is usually Toolbar
            if (this.AssociatedObject.RowDefinitions.Count > 1)
            {
                view.SetValue(Grid.RowSpanProperty, this.AssociatedObject.RowDefinitions.Count - 1);
                view.SetValue(Grid.RowProperty, 1);
            }

            view.SetValue(Grid.ColumnSpanProperty, this.AssociatedObject.ColumnDefinitions.Count == 0 ? 1 : this.AssociatedObject.ColumnDefinitions.Count);
            view.Width = 500;
            view.HorizontalAlignment = HorizontalAlignment.Right;

            this.AssociatedObject.Children.Add(view);
        }

      

Basically, I am adding the view as a child to the grid. He walks over to the right side.

I want to make this view slide from the right side and stop. I have no idea how to approach it and what should I do to achieve this visual effect. Any pointers to what and where I need to add? Maybe a link to a similar effect?

I found the animation code here: http://forums.silverlight.net/t/82441.aspx

It makes sense, however, when I hide my view - I this.AssociatedObject.Children.Remove(view)

remove it completely from the visual tree like this: Not sure how to "wait" and then remove it.

+3


source to share


1 answer


Take a look at Microsoft's Expression Blend tool, designed specifically for creating such visual effects.

What you want to do can be achieved with the Story Panel and is quite simple to do!

Basically, once the storyboard has been created (the case of defining the start position and the end position - according to the time (or frames)), you can trigger the storyboard when a certain event is triggered.

I know this is not a definitive answer, but here are some tutorials to get you going:



http://www.silverlightbuzz.com/2009/10/12/animating-with-storyboards-in-blend/ http://www.c-sharpcorner.com/uploadfile/mamta_m/creating-and-using-storyboards- in-blendsilverlight-part-i / http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CE4QFjAD&url=http%3A%2F%2Fmsdn.microsoft.com% 2Fen-us% 2Flibrary% 2Fcc295092.aspx & ei = NDRzT42uPNS_8gPrz6xW & usg = AFQjCNGwT_hEkwGBXzS3holaM1g85I0S5Q & sig2 = dSDJ6lL0CR3-nIR7WQ739

Thanks and good luck!

Ben

+1


source







All Articles