Esempio n. 1
0
        protected override Size MeasureOverride(Size constraint)
        {
            InitializeChildrens();
            var    width  = constraint.Width - indent;
            double height = 0;

            expander.Measure(new Size(width, constraint.Height));
            width -= expander.DesiredSize.Width;
            height = Math.Max(height, expander.DesiredSize.Height);

            if (!icon.ImageReference.IsDefault)
            {
                icon.Measure(new Size(width, constraint.Height));
                width -= icon.DesiredSize.Width;
                height = Math.Max(height, icon.DesiredSize.Height);
            }

            content.Measure(new Size(width, constraint.Height));
            width -= content.DesiredSize.Width;
            height = Math.Max(height, content.DesiredSize.Height);

            var iconWidth = icon.ImageReference.IsDefault ? 0 : icon.DesiredSize.Width;

            return(new Size(indent + expander.DesiredSize.Width + iconWidth + content.DesiredSize.Width, height));
        }
Esempio n. 2
0
        protected override Size MeasureOverride(Size constraint)
        {
            InitializeChildrens();
            var    width  = constraint.Width - indent;
            double height = 0;

            expander.Measure(new Size(width, constraint.Height));
            width -= expander.DesiredSize.Width;
            height = Math.Max(height, expander.DesiredSize.Height);

            icon.Measure(constraint);
            width -= icon.DesiredSize.Width;
            height = Math.Max(height, icon.DesiredSize.Height);

            content.Measure(constraint);
            width -= content.DesiredSize.Width;
            height = Math.Max(height, content.DesiredSize.Height);

            return(new Size(expander.DesiredSize.Width + icon.DesiredSize.Width + content.DesiredSize.Width, height));
        }