private static void OnStateChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { if (obj is SldSelectionBox) { var selectionBox = obj as SldSelectionBox; SldPMPage.RegisterSelectionBox(selectionBox); } }
internal override int AddToPage(SldPMPage page, int id) { VerifySControlForCreate(); ID = id; var option = (int)(swAddGroupBoxOptions_e.swGroupBoxOptions_Expanded | swAddGroupBoxOptions_e.swGroupBoxOptions_Visible); SControl = page.Page.AddGroupBox(id, Caption, option) as IPropertyManagerPageGroup; id++; if (SControl == null) { throw new NullReferenceException($"添加GroupBox错误:{Caption}"); } else { SControl.Visible = Visible; if (HasCheckBox) { SControl.Checked = Checked; } if (BackgroundColor != null) { SControl.BackgroundColor = Information.RGB(BackgroundColor.Value.R, BackgroundColor.Value.G, BackgroundColor.Value.B);; } SControl.Expanded = Expanded; } //添加子控件 foreach (var child in Children) { //添加为可视化子元素 给绑定提供路径 this.AddVisualChild(child); //if (child is SldSelectionBox selectionBox) //{ id = child.AddToGroup(SControl, id); // } } return(++id); }