Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Windows.Controls;
|
---|
6 | using System.Windows;
|
---|
7 |
|
---|
8 | namespace Microsoft.Research.DynamicDataDisplay.Charts.Shapes
|
---|
9 | {
|
---|
10 | internal sealed class SimpleGrid : Panel
|
---|
11 | {
|
---|
12 | protected override Size MeasureOverride(Size availableSize)
|
---|
13 | {
|
---|
14 | Size size = new Size(Double.PositiveInfinity, Double.PositiveInfinity);
|
---|
15 |
|
---|
16 | double maxWidth = Double.NegativeInfinity;
|
---|
17 | double maxheight = Double.NegativeInfinity;
|
---|
18 | foreach (UIElement element in InternalChildren)
|
---|
19 | {
|
---|
20 | if (element != null)
|
---|
21 | {
|
---|
22 | element.Measure(size);
|
---|
23 |
|
---|
24 | maxWidth = Math.Max(maxWidth, element.DesiredSize.Width);
|
---|
25 | maxheight = Math.Max(maxheight, element.DesiredSize.Height);
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | return new Size(maxWidth, maxheight);
|
---|
30 | }
|
---|
31 |
|
---|
32 | protected override Size ArrangeOverride(Size finalSize)
|
---|
33 | {
|
---|
34 | foreach (UIElement element in InternalChildren)
|
---|
35 | {
|
---|
36 | if (element == null)
|
---|
37 | continue;
|
---|
38 |
|
---|
39 | element.Arrange(new Rect(element.DesiredSize));
|
---|
40 | }
|
---|
41 |
|
---|
42 | return finalSize;
|
---|
43 | }
|
---|
44 | }
|
---|
45 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.