2 using System.Collections.Generic;
6 using System.Windows.Controls;
17 protected override System.Windows.Size
MeasureOverride(System.Windows.Size availableSize)
19 foreach (UIElement child
in InternalChildren)
21 child.Measure(availableSize);
26 protected override System.Windows.Size
ArrangeOverride(System.Windows.Size finalSize)
28 double geniesWidth = 0;
29 double geniesHeight = 0;
30 Boolean geniesVertical =
false;
31 Boolean graphTop =
true;
33 UIElementCollection children = InternalChildren;
36 UIElement genie2 = null;
38 if (children[0].IsVisible)
43 if (children[2].IsVisible)
47 if (2.0 * genie1.DesiredSize.Width > finalSize.Width)
49 geniesVertical =
true;
50 geniesWidth = genie1.DesiredSize.Width;
51 geniesHeight = 2.0 * genie1.DesiredSize.Height;
55 geniesVertical =
false;
56 geniesWidth = 2.0 * genie1.DesiredSize.Width;
57 geniesHeight = genie1.DesiredSize.Height;
62 geniesVertical =
false;
63 geniesWidth = genie1.DesiredSize.Width;
64 geniesHeight = genie1.DesiredSize.Height;
68 double topHeight = finalSize.Height - geniesHeight;
69 double topWidth = finalSize.Width;
70 double topArea = topHeight * topWidth;
72 double rightHeight = finalSize.Height;
73 double rightWidth = finalSize.Width - geniesWidth;
74 double rightArea = rightHeight * rightWidth;
82 if (finalSize.Width - geniesWidth > finalSize.Height - geniesHeight && rightHeight / rightWidth > topHeight / topWidth)
90 graph.Arrange(
new Rect(0, 0, finalSize.Width, finalSize.Height - geniesHeight));
91 System.Windows.Controls.Primitives.UniformGrid temp = graph as System.Windows.Controls.Primitives.UniformGrid;
94 temp.Columns = temp.Children.Count;
97 genie1.Arrange(
new Rect(
new Point(0, finalSize.Height - geniesHeight), genie1.DesiredSize));
102 genie2.Arrange(
new Rect(
new Point(0, finalSize.Height - geniesHeight + genie1.DesiredSize.Height), genie2.DesiredSize));
106 genie2.Arrange(
new Rect(
new Point(genie1.DesiredSize.Width, finalSize.Height - geniesHeight), genie2.DesiredSize));
112 genie1.Arrange(
new Rect(
new Point(0, 0), genie1.DesiredSize));
115 genie2.Arrange(
new Rect(
new Point(0, genie1.DesiredSize.Height), genie2.DesiredSize));
117 graph.Arrange(
new Rect(genie1.DesiredSize.Width, 0, finalSize.Width - genie1.DesiredSize.Width, finalSize.Height));
118 System.Windows.Controls.Primitives.UniformGrid temp = graph as System.Windows.Controls.Primitives.UniformGrid;
122 temp.Rows = temp.Children.Count;
126 else if (children[1].IsVisible)
129 genie1 = children[1];
130 if (children[2].IsVisible)
132 genie2 = children[2];
134 genie1.Arrange(
new Rect(
new Point(0, 0), genie1.DesiredSize));
138 if (2.0 * genie1.DesiredSize.Width > finalSize.Width)
140 genie2.Arrange(
new Rect(
new Point(0, genie1.DesiredSize.Height), genie2.DesiredSize));
144 genie2.Arrange(
new Rect(
new Point(genie1.DesiredSize.Width, 0), genie2.DesiredSize));
override System.Windows.Size MeasureOverride(System.Windows.Size availableSize)
override System.Windows.Size ArrangeOverride(System.Windows.Size finalSize)