我使用以下代碼來注入視圖成網格:使用戶控件從屏幕的一側「滑出」?
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);
}
基本上,我添加視圖作爲子到電網。它靠碼頭到右邊。
我想讓它看起來像這個視圖滑出右側並停下來。我不知道如何接近它,我該怎麼做才能達到這種視覺效果。任何指針什麼和我需要添加的地方?也許鏈接到類似的效果?
我發現了一些動畫代碼在這裏:http://forums.silverlight.net/t/82441.aspx
這是有道理的,但是當我躲在我的看法 - 我完全可視樹,像這樣將其刪除:this.AssociatedObject.Children.Remove(view)
不知道如何「等待」,然後將其刪除。
我推薦Expression Blend。 – Jordan 2012-03-28 14:31:14