LayoutDocumentPaneGroup.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.Collections.ObjectModel;
  15. using System.Windows;
  16. using System.Windows.Controls;
  17. using System.Windows.Markup;
  18. namespace Xceed.Wpf.AvalonDock.Layout
  19. {
  20. [ContentProperty("Children")]
  21. [Serializable]
  22. public class LayoutDocumentPaneGroup : LayoutPositionableGroup<ILayoutDocumentPane>, ILayoutDocumentPane, ILayoutOrientableGroup
  23. {
  24. public LayoutDocumentPaneGroup()
  25. {
  26. }
  27. public LayoutDocumentPaneGroup(LayoutDocumentPane documentPane)
  28. {
  29. Children.Add(documentPane);
  30. }
  31. #region Orientation
  32. private Orientation _orientation;
  33. public Orientation Orientation
  34. {
  35. get { return _orientation; }
  36. set
  37. {
  38. if (_orientation != value)
  39. {
  40. RaisePropertyChanging("Orientation");
  41. _orientation = value;
  42. RaisePropertyChanged("Orientation");
  43. }
  44. }
  45. }
  46. #endregion
  47. protected override bool GetVisibility()
  48. {
  49. return true;
  50. }
  51. public override void WriteXml(System.Xml.XmlWriter writer)
  52. {
  53. writer.WriteAttributeString("Orientation", Orientation.ToString());
  54. base.WriteXml(writer);
  55. }
  56. public override void ReadXml(System.Xml.XmlReader reader)
  57. {
  58. if (reader.MoveToAttribute("Orientation"))
  59. Orientation = (Orientation)Enum.Parse(typeof(Orientation), reader.Value, true);
  60. base.ReadXml(reader);
  61. }
  62. #if TRACE
  63. public override void ConsoleDump(int tab)
  64. {
  65. System.Diagnostics.Trace.Write( new string( ' ', tab * 4 ) );
  66. System.Diagnostics.Trace.WriteLine( string.Format( "DocumentPaneGroup({0})", Orientation ) );
  67. foreach (LayoutElement child in Children)
  68. child.ConsoleDump(tab + 1);
  69. }
  70. #endif
  71. }
  72. }