source: trunk/CrypPlugins/WorkspaceManager/View/VisualComponents/ModifiedCanvas/ModifiedCanvas.cs @ 2007

Last change on this file since 2007 was 2007, checked in by matkovic, 11 years ago

-Mandatory Connector now indicated by the red border
-Textbox added for custom description
-Major Style changes
-Icon updated
-WorkSpace Scrolling now Possible

File size: 1.2 KB
RevLine 
[2007]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Controls;
6using System.Windows;
7
8namespace WorkspaceManager.View.VisualComponents
9{
10    public class ModifiedCanvas : Canvas
11    {
12        protected override Size MeasureOverride(Size constraint)
13        {
14            Size availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
15            double maxHeight = 0;
16            double maxWidth = 0;
17
18            foreach (UIElement element in base.InternalChildren)
19            {
20                if (element != null)
21                {
22                    element.Measure(availableSize);
23                    double left = Canvas.GetLeft(element);
24                    double top = Canvas.GetTop(element);
25                    left += element.DesiredSize.Width;
26                    top += element.DesiredSize.Height;
27
28                    maxWidth = maxWidth < left ? left : maxWidth;
29                    maxHeight = maxHeight < top ? top : maxHeight;
30                }
31            }
32            return new Size { Height = maxHeight, Width = maxWidth };
33        }
34    }
35}
Note: See TracBrowser for help on using the repository browser.