示例#1
0
        public static GridLength Parse(string source, DisplayMetrics metrics)
        {
            if (source.ToLower() == "auto")
            {
                return(new GridLength(1, GridUnitType.Auto));
            }
            if (source == "*")
            {
                return(new GridLength(1, GridUnitType.Star));
            }
            if (source.EndsWith("*"))
            {
                return(new GridLength(double.Parse(source.Substring(0, source.Length - 1)), GridUnitType.Star));
            }

            return(new GridLength(DimensionConverter.StringToDimensionPixelSize(source, metrics)));
        }