Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/Shapes/SimpleGrid.cs @ 12747

Last change on this file since 12747 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Controls;
6using System.Windows;
7
8namespace 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.