예제 #1
0
        internal int AddGridRow(string height)
        {
            var gridRow = new GridRow(InternalGridRows, GridRows.Count, GridLengthParser.Parse(height));

            InternalGridRows.Add(gridRow);
            return(gridRow.Ordinal);
        }
예제 #2
0
        internal int AddGridColumn(string width)
        {
            var gridColumn = new GridColumn(InternalGridColumns, GridColumns.Count, GridLengthParser.Parse(width));

            InternalGridColumns.Add(gridColumn);
            return(gridColumn.Ordinal);
        }
예제 #3
0
 private static void VerifyFormatExceptionExpected(string input)
 {
     try
     {
         GridLengthParser.Parse(input);
         Assert.Fail(string.Format("A FormatException should be thrown for input string '{0}'", input));
     }
     catch (FormatException ex)
     {
         Assert.AreEqual(ex.Message, DiagnosticMessages.GridLengthParser_InvalidInput(input));
     }
 }
예제 #4
0
        public void GridLengthParser_Parse()
        {
            {
                var result = GridLengthParser.Parse("10");
                Verify(result, new GridLength(10), 0.0, double.PositiveInfinity);
            }

            {
                var result = GridLengthParser.Parse("10; min: 5");
                Verify(result, new GridLength(10), 5.0, double.PositiveInfinity);
            }

            {
                var result = GridLengthParser.Parse("10; min: 5; max: 20");
                Verify(result, new GridLength(10), 5.0, 20.0);
            }

            {
                var result = GridLengthParser.Parse("10; min: 5; max: 20;");
                Verify(result, new GridLength(10), 5.0, 20.0);
            }

            {
                var result = GridLengthParser.Parse("10; MIN: 5; MAX: 20;");
                Verify(result, new GridLength(10), 5.0, 20.0);
            }

            {
                var result = GridLengthParser.Parse("*; MIN: 5; MAX: 20;");
                Verify(result, new GridLength(1, GridUnitType.Star), 5.0, 20.0);
            }

            {
                var result = GridLengthParser.Parse("2*; MIN: 5; MAX: 20;");
                Verify(result, new GridLength(2, GridUnitType.Star), 5.0, 20.0);
            }

            {
                var result = GridLengthParser.Parse("Auto; MIN: 5; MAX: 20;");
                Verify(result, GridLength.Auto, 5.0, 20.0);
            }
        }