LayoutDocumentPaneGroupControl.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.Windows.Controls;
  15. using System.Windows;
  16. using Xceed.Wpf.AvalonDock.Layout;
  17. namespace Xceed.Wpf.AvalonDock.Controls
  18. {
  19. public class LayoutDocumentPaneGroupControl : LayoutGridControl<ILayoutDocumentPane>, ILayoutControl
  20. {
  21. internal LayoutDocumentPaneGroupControl(LayoutDocumentPaneGroup model)
  22. :base(model, model.Orientation)
  23. {
  24. _model = model;
  25. }
  26. LayoutDocumentPaneGroup _model;
  27. protected override void OnFixChildrenDockLengths()
  28. {
  29. #region Setup DockWidth/Height for children
  30. if (_model.Orientation == Orientation.Horizontal)
  31. {
  32. for (int i = 0; i < _model.Children.Count; i++)
  33. {
  34. var childModel = _model.Children[i] as ILayoutPositionableElement;
  35. if (!childModel.DockWidth.IsStar)
  36. {
  37. childModel.DockWidth = new GridLength(1.0, GridUnitType.Star);
  38. }
  39. }
  40. }
  41. else
  42. {
  43. for (int i = 0; i < _model.Children.Count; i++)
  44. {
  45. var childModel = _model.Children[i] as ILayoutPositionableElement;
  46. if (!childModel.DockHeight.IsStar)
  47. {
  48. childModel.DockHeight = new GridLength(1.0, GridUnitType.Star);
  49. }
  50. }
  51. }
  52. #endregion
  53. }
  54. }
  55. }