void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 8 "..\..\..\Views\MainView.xaml" ((XCode.Module.ChickenSoup.Views.MainView)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden return; case 2: this.Scroll = ((System.Windows.Controls.ScrollViewer)(target)); #line 10 "..\..\..\Views\MainView.xaml" this.Scroll.ScrollChanged += new System.Windows.Controls.ScrollChangedEventHandler(this.ScrollViewer_ScrollChanged); #line default #line hidden return; case 3: this.Container = ((XCode.Common.Controls.Panels.WaterfallPanel)(target)); return; } this._contentLoaded = true; }
/// <summary> /// 负责调整chlid宽度以及位置 /// </summary> /// <param name="ele"></param> private void AddNewChild(FrameworkElement ele) { if (_colHeight.Count == 0) { return; } //设置新添加的child的宽度 ele.Width = ChildWidth; //得到应插入的列 int insertCol = _colHeight.IndexOf(_colHeight.Min()); //计算位置 double left = Padding.Left + insertCol * (ChildMargin.Left + ChildMargin.Right + ChildWidth); double top = _colHeight.Min() + ChildMargin.Top; //设置位置 WaterfallPanel.SetLeft(ele, left); WaterfallPanel.SetTop(ele, top); //重新调整该列高度 _colHeight[insertCol] += ChildMargin.Top + ChildMargin.Bottom + ele.ActualHeight; //调整高度 this.Height = _colHeight.Max(); }