AerialForWindows.UIHelper.TabControlEx.MaxDimensionConverter.Convert C# (CSharp) Method

Convert() public method

public Convert ( object value, Type targetType, object parameter, CultureInfo culture ) : object
value object
targetType System.Type
parameter object
culture System.Globalization.CultureInfo
return object
            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            {
                var items = value as ItemCollection;
                if (items == null) {
                    return null;
                }

                double max = 0;
                foreach (TabItem item in items) {
                    var content = item.Content as FrameworkElement;
                    if (content == null) {
                        continue;
                    }

                    if (!content.IsMeasureValid) {
                        content.Measure(new Size(int.MaxValue, int.MaxValue));
                    }

                    var length = _checkHeight ? content.DesiredSize.Height : content.DesiredSize.Width;
                    if (max < length) {
                        max = length;
                    }
                }

                return max;
            }
TabControlEx.MaxDimensionConverter