Пример #1
0
 /// <summary>
 /// Handle a change in the Children collection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Children_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (AnalysisChild _child in e.NewItems)
         {
             if (_child.Width > this.AnalysisGrid.ActualWidth)
             {
                 _child.Width = this.AnalysisGrid.ActualWidth;
                 Canvas.SetLeft(_child, 0);
             }
             if (_child.Height > this.AnalysisGrid.ActualHeight)
             {
                 _child.Height = this.AnalysisGrid.ActualHeight;
                 Canvas.SetTop(_child, 0);
             }
             // if the child doesn't exist as an attached or detached window the init its zindex, parent and set it unselected
             if (!this.AttachedChildren.Contains(_child) && !this.DetachedChildren.Contains(_child))
             {
                 _child.MwiParent  = this; // a chld was added, make sure its parent is set to this control
                 _child.IsSelected = false;
                 Canvas.SetZIndex(_child, zindex++);
             }
             AttachedChildren.Add(_child);
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         foreach (AnalysisChild _child in e.OldItems)
         {
             AttachedChildren.Remove(_child);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Handle a change in the MinChildren collection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void MinChildren_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Add)
     {
         foreach (AnalysisChild _child in e.NewItems)
         {
             AttachedChildren.Add(_child);
         }
     }
     else if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         foreach (AnalysisChild _child in e.OldItems)
         {
             AttachedChildren.Remove(_child);
         }
     }
 }