AC.AvalonControlsLibrary.Controls.CellSizeConverter.Convert C# (CSharp) Method

Convert() public method

Converter for the calender control to measure the widths to calculate
public Convert ( object value, Type targetType, object parameter, System culture ) : object
value object Pass the Actual width of the parent control
targetType System.Type Target type
parameter object Pass widthCell to calculate the width a particular cell. /// Pass widthCellContainer to calculate the witdth of the parent control
culture System The current culture in use
return object
        public override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double valuePassed = (double)value;

            if (parameter != null && !Double.IsNaN(valuePassed))
            {
                if (parameter.ToString() == "widthCell")
                {
                    return Math.Max(valuePassed / daysToFitHorizontal, minimumValue) - 2;
                }

                if (parameter.ToString() == "widthCellContainer")
                {
                    return Math.Max(valuePassed-10, minimumValue);
                }
            }
            return 20.0;
        }
CellSizeConverter