/// <summary> /// 初始化整个布局 /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <param name="layout"></param> public static void Initialize(FrameworkElement left, FrameworkElement right, ParentChildProportion leftRightPercent = null) { //layout.AggtBlocks.Layout.ParentChildProportion leftRightPercent = leftRightPercent ?? ParentChildProportion.Default; ResizingPanelExt.SetStarGridLength(left, leftRightPercent.Parent); ResizingPanelExt.SetStarGridLength(right, leftRightPercent.Children); AnimationTimeline show = new DoubleAnimationUsingKeyFrames { KeyFrames = new DoubleKeyFrameCollection() { new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0)) }, new EasingDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1)), Value = leftRightPercent.Children, EasingFunction = new ElasticEase { EasingMode = EasingMode.EaseOut, Springiness = 10 } } } }; AnimationTimeline hide = new DoubleAnimation() { From = leftRightPercent.Children, Duration = new Duration(TimeSpan.FromMilliseconds(100)), To = 0 }; //监听 childrenTab.VisiblityChanged 事件,播放动画效果 DependencyPropertyDescriptor.FromProperty(UIElement.VisibilityProperty, typeof(UIElement)) .AddValueChanged(right, (o, e) => { right.BeginAnimation( ResizingPanelExt.StarGridLengthProperty, right.Visibility == Visibility.Visible ? show : hide ); }); }
public void Arrange(UIComponents components) { var control = components.Main; if (control != null) { result.Content = control.Control; } else { result.RemoveFromParent(); } var toolBar = components.CommandsContainer; if (toolBar != null) { toolBarContainer.Content = toolBar.Control; } else { toolBarContainer.RemoveFromParent(); } //Children components.ArrangeChildrenByTabControl(childrenTab); if (childrenTab.Parent != null) { ResizingPanelExt.SetStarGridLength(detail, 3); ResizingPanelExt.SetStarGridLength(childrenTab, 7); if (components.LayoutMeta.IsLayoutChildrenHorizonal) { container.Orientation = Orientation.Horizontal; } else { container.Orientation = Orientation.Vertical; } } }