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;



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:

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.


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: in-blendsilverlight-part-i / 2Fen-us% 2Flibrary% 2Fcc295092.aspx & ei = NDRzT42uPNS_8gPrz6xW & usg = AFQjCNGwT_hEkwGBXzS3holaM1g85I0S5Q & sig2 = dSDJ6lL0CR3-nIR7WQ739

Thanks and good luck!




All Articles