Subversion Repositories SoapBoxCore

Rev

Rev 7 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 17
Line 1... Line 1...
1
//Copyright (c) 2007-2009, Adolfo Marinucci
1
//Copyright (c) 2007-2010, Adolfo Marinucci
2
//All rights reserved.
2
//All rights reserved.
3
 
3
 
4
//Redistribution and use in source and binary forms, with or without modification, 
4
//Redistribution and use in source and binary forms, with or without modification, 
5
//are permitted provided that the following conditions are met:
5
//are permitted provided that the following conditions are met:
6
//
6
//
Line 59... Line 59...
59
            DependencyProperty.RegisterAttached("IsHeaderVisible", typeof(bool), typeof(DocumentTabPanel), new UIPropertyMetadata(false));
59
            DependencyProperty.RegisterAttached("IsHeaderVisible", typeof(bool), typeof(DocumentTabPanel), new UIPropertyMetadata(false));
60
 
60
 
61
 
61
 
62
        protected override Size MeasureOverride(Size availableSize)
62
        protected override Size MeasureOverride(Size availableSize)
63
        {
63
        {
64
            Size desideredSize = new Size(0, availableSize.Height);
64
            Size desideredSize = new Size();
65
            int i = 1;
65
            int i = 1;
66
 
66
 
67
            foreach (ManagedContent child in Children)
67
            foreach (ManagedContent child in Children)
68
            {
68
            {
69
                Panel.SetZIndex(child, Selector.GetIsSelected(child)?1:-i);
69
                Panel.SetZIndex(child, Selector.GetIsSelected(child)?1:-i);
70
                i++;
70
                i++;
71
                child.Width = double.NaN;
71
                //child.Width = double.NaN;
72
                child.Height = double.NaN;
72
                //child.Height = double.NaN;
73
                child.Measure(new Size(double.PositiveInfinity, availableSize.Height));
73
                child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
74
                desideredSize.Width += child.DesiredSize.Width;
74
                desideredSize.Width += child.DesiredSize.Width;
-
 
75
                desideredSize.Height = Math.Max(desideredSize.Height, child.DesiredSize.Height);
75
            }
76
            }
76
 
77
 
-
 
78
            return new Size(Math.Min(desideredSize.Width, availableSize.Width), desideredSize.Height);
77
            return base.MeasureOverride(availableSize);
79
            //return base.MeasureOverride(availableSize);
78
            //return desideredSize;
80
            //return desideredSize;
79
        }
81
        }
80
 
82
 
81
        protected override Size ArrangeOverride(Size finalSize)
83
        protected override Size ArrangeOverride(Size finalSize)
82
        {
84
        {
Line 99... Line 101...
99
            }
101
            }
100
 
102
 
101
            return finalSize;
103
            return finalSize;
102
 
104
 
103
        }
105
        }
-
 
106
 
-
 
107
        //#region Padding
-
 
108
 
-
 
109
        ///// <summary>
-
 
110
        ///// Padding Dependency Property
-
 
111
        ///// </summary>
-
 
112
        //public static readonly DependencyProperty PaddingProperty =
-
 
113
        //    DependencyProperty.Register("Padding", typeof(Thickness), typeof(DocumentTabPanel),
-
 
114
        //        new FrameworkPropertyMetadata((Thickness)new Thickness(),
-
 
115
        //            FrameworkPropertyMetadataOptions.AffectsMeasure));
-
 
116
 
-
 
117
        ///// <summary>
-
 
118
        ///// Gets or sets the Padding property.  This dependency property 
-
 
119
        ///// indicates internal padding of the panel.
-
 
120
        ///// </summary>
-
 
121
        //public Thickness Padding
-
 
122
        //{
-
 
123
        //    get { return (Thickness)GetValue(PaddingProperty); }
-
 
124
        //    set { SetValue(PaddingProperty, value); }
-
 
125
        //}
-
 
126
 
-
 
127
        //#endregion
-
 
128
 
-
 
129
 
104
    }
130
    }
105
}
131
}
106
 
132