internal int AddGridRow(string height) { var gridRow = new GridRow(InternalGridRows, GridRows.Count, GridLengthParser.Parse(height)); InternalGridRows.Add(gridRow); return(gridRow.Ordinal); }
internal int AddGridColumn(string width) { var gridColumn = new GridColumn(InternalGridColumns, GridColumns.Count, GridLengthParser.Parse(width)); InternalGridColumns.Add(gridColumn); return(gridColumn.Ordinal); }
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)); } }
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); } }