private void OnModelChildrenCollectionChanged(NotifyCollectionChangedEventArgs e) { if (e.OldItems != null && (e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Replace)) { foreach (object oldItem in e.OldItems) { this._childViews.Remove(this._childViews.First <LayoutAnchorGroupControl>((LayoutAnchorGroupControl cv) => cv.Model == oldItem)); } } if (e.Action == NotifyCollectionChangedAction.Reset) { this._childViews.Clear(); } if (e.NewItems != null && (e.Action == NotifyCollectionChangedAction.Add || e.Action == NotifyCollectionChangedAction.Replace)) { DockingManager manager = this._model.Root.Manager; int newStartingIndex = e.NewStartingIndex; foreach (LayoutAnchorGroup newItem in e.NewItems) { int num = newStartingIndex; newStartingIndex = num + 1; this._childViews.Insert(num, manager.CreateUIElementForModel(newItem) as LayoutAnchorGroupControl); } } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); DockingManager manager = this._model.Root.Manager; base.Content = manager.CreateUIElementForModel(this._model.RootPanel); base.IsVisibleChanged += new DependencyPropertyChangedEventHandler((object s, DependencyPropertyChangedEventArgs args) => { BindingExpression bindingExpression = base.GetBindingExpression(UIElement.VisibilityProperty); if (base.IsVisible && bindingExpression == null) { base.SetBinding(UIElement.VisibilityProperty, new Binding("IsVisible") { Source = this._model, Converter = new BoolToVisibilityConverter(), Mode = BindingMode.OneWay, ConverterParameter = System.Windows.Visibility.Hidden }); } }); base.SetBinding(LayoutAnchorableFloatingWindowControl.SingleContentLayoutItemProperty, new Binding("Model.SinglePane.SelectedContent") { Source = this, Converter = new LayoutItemFromLayoutModelConverter() }); this._model.PropertyChanged += new PropertyChangedEventHandler(this._model_PropertyChanged); }
private void CreateChildrenViews() { DockingManager manager = this._model.Root.Manager; foreach (LayoutAnchorGroup child in this._model.Children) { this._childViews.Add(manager.CreateUIElementForModel(child) as LayoutAnchorGroupControl); } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); if (this._model.RootDocument == null) { base.InternalClose(); return; } DockingManager manager = this._model.Root.Manager; base.Content = manager.CreateUIElementForModel(this._model.RootDocument); this._model.RootDocumentChanged += new EventHandler(this._model_RootDocumentChanged); }
private void UpdateChildren() { ILayoutControl[] array = base.Children.OfType <ILayoutControl>().ToArray <ILayoutControl>(); this.DetachOldSplitters(); this.DetachPropertChangeHandler(); base.Children.Clear(); base.ColumnDefinitions.Clear(); base.RowDefinitions.Clear(); if (this._model == null || this._model.Root == null) { return; } DockingManager manager = this._model.Root.Manager; if (manager == null) { return; } foreach (T child in this._model.Children) { ILayoutElement layoutElement = child; ILayoutControl layoutControl = array.FirstOrDefault <ILayoutControl>((ILayoutControl chVM) => chVM.Model == layoutElement); if (layoutControl == null) { base.Children.Add(manager.CreateUIElementForModel(layoutElement)); } else { base.Children.Add(layoutControl as UIElement); } } this.CreateSplitters(); this.UpdateRowColDefinitions(); this.AttachNewSplitters(); this.AttachPropertyChangeHandler(); }