public void HaveGridLengthOfThreeWhenParsingStars() { var result = AutoGrid.Parse("*,*,*,*"); result.ToList().ForEach(x => x.Should().Be(new GridLength(1, GridUnitType.Star))); }
public void HaveGridLengthOfThreeWhenParsingNumbers() { var result = AutoGrid.Parse("3,3,3,3"); result.ToList().ForEach(x => x.Should().Be(new GridLength(3))); }
public AutoGridWithTwoStarColumnsShould() { _sut = new AutoGrid(); _sut.Children.Add(new Button()); _sut.Children.Add(new Button()); _sut.Columns = "*,*"; _sut.PerformLayout(); }
public when_mixed_row_definition_and_column_count_are_set() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Rows = "10"; Subject.PerformLayout(); }
public AutoGridWithStarColumnsAndVerticalOrientationShould() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Orientation = Orientation.Vertical; Subject.Rows = "*,*"; Subject.PerformLayout(); }
public AutoGridWithStarAndAutoColumnsAndVerticalOrientationShould() { _sut = new AutoGrid(); _sut.Children.Add(new Button()); _sut.Children.Add(new Button()); _sut.Orientation = Orientation.Vertical; _sut.Columns = "*,Auto"; _sut.PerformLayout(); }
public AutoGridWithRowAndColumnDefinitionsShould() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Rows = "10"; Subject.Columns = "100,*"; Subject.PerformLayout(); }
public when_rows_are_defined_and_adding_many_elements_with_one_missing() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Columns = "100,*"; Subject.PerformLayout(); }
public when_setting_one_row_height_and_adding_many_elements() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Columns = "100,*"; Subject.PerformLayout(); }
public when_overriding_column_width() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); var additionalElement = new TextBlock(); AutoGrid.SetColumnWidthOverride(additionalElement, new GridLength(1, GridUnitType.Star)); Subject.Children.Add(additionalElement); Subject.Rows = "*"; Subject.ColumnWidth = GridLength.Auto; Subject.PerformLayout(); }
public when_overriding_row_height_and_vertical() { Subject = new AutoGrid(); Subject.Orientation = Orientation.Vertical; Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); var additionalElement = new TextBlock(); AutoGrid.SetRowHeightOverride(additionalElement, new GridLength(1, GridUnitType.Star)); Subject.Children.Add(additionalElement); Subject.Columns = "*"; Subject.RowHeight = GridLength.Auto; Subject.PerformLayout(); }
public when_rows_are_defined_with_column_span_and_adding_many_elements() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); var spannedElement = new Button(); Grid.SetColumnSpan(spannedElement, 2); Subject.Children.Add(spannedElement); Subject.Columns = "100,*"; Subject.PerformLayout(); }
public when_adding_additional_elements_outside_auto_assignment() { Subject = new AutoGrid(); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); var additionalElement = new TextBlock(); AutoGrid.SetAutoIndex(additionalElement, false); Grid.SetColumn(additionalElement, 0); Grid.SetRow(additionalElement, 0); Grid.SetColumnSpan(additionalElement, 1); Subject.Children.Add(additionalElement); Subject.Columns = "100,100"; Subject.PerformLayout(); }
/// <summary> /// 使用 AutoGrid 来生成表单。 /// </summary> /// <param name="detailView"></param> /// <param name="properties"></param> /// <returns></returns> protected FrameworkElement GenerateGridEditors(DetailLogicalView detailView, IEnumerable <WPFEntityPropertyViewMeta> properties) { var panel = new AutoGrid { ColumnsCount = detailView.CalculateColumnsCount(properties), Orientation = detailView.Meta.DetailAsHorizontal ? Orientation.Horizontal : Orientation.Vertical }; foreach (var propertyView in properties) { panel.Children.Add(new EditorHost { EntityProperty = propertyView }); } return(EnableScoller(panel, panel.Orientation)); }
public WhenRowSpanningWithMultipleColumnsVertical() { Subject = new AutoGrid { Rows = "Auto,Auto", Orientation = Orientation.Vertical, }; var wideButton = new Button(); Grid.SetColumnSpan(wideButton, 99); Subject.Children.Add(wideButton); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.PerformLayout(); }
public WhenRowSpanningWithMultipleColumns() { Subject = new AutoGrid { Columns = "Auto,Auto,Auto", Orientation = Orientation.Horizontal, }; var tallButton = new Button(); Grid.SetRowSpan(tallButton, 99); Subject.Children.Add(tallButton); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.Children.Add(new Button()); Subject.PerformLayout(); }