LayoutGroupBase.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*************************************************************************************
  2. Extended WPF Toolkit
  3. Copyright (C) 2007-2013 Xceed Software Inc.
  4. This program is provided to you under the terms of the Microsoft Public
  5. License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
  6. For more features, controls, and fast professional support,
  7. pick up the Plus Edition at http://xceed.com/wpf_toolkit
  8. Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
  9. ***********************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Xml.Serialization;
  15. namespace Xceed.Wpf.AvalonDock.Layout
  16. {
  17. [Serializable]
  18. public abstract class LayoutGroupBase : LayoutElement
  19. {
  20. [field: NonSerialized]
  21. [field: XmlIgnore]
  22. public event EventHandler ChildrenCollectionChanged;
  23. protected virtual void OnChildrenCollectionChanged()
  24. {
  25. if (ChildrenCollectionChanged != null)
  26. ChildrenCollectionChanged(this, EventArgs.Empty);
  27. }
  28. protected void NotifyChildrenTreeChanged(ChildrenTreeChange change)
  29. {
  30. OnChildrenTreeChanged(change);
  31. var parentGroup = Parent as LayoutGroupBase;
  32. if (parentGroup != null)
  33. parentGroup.NotifyChildrenTreeChanged(ChildrenTreeChange.TreeChanged);
  34. }
  35. [field: NonSerialized]
  36. [field: XmlIgnore]
  37. public event EventHandler<ChildrenTreeChangedEventArgs> ChildrenTreeChanged;
  38. protected virtual void OnChildrenTreeChanged(ChildrenTreeChange change)
  39. {
  40. if (ChildrenTreeChanged != null)
  41. ChildrenTreeChanged(this, new ChildrenTreeChangedEventArgs(change));
  42. }
  43. }
  44. }