private static Panel CreateInnerVerticalPanel(PanelFactory panelFactory) { Panel panel1 = panelFactory.CreatePanel(Orientation.Vertical); panel1.Background = new SolidColorBrush(Colors.Green); panel1.Margin = new Thickness(5); panel1.Height = 100; panel1.Width = 50; AddRectanglesToPanel(panel1, 20, 20); return(panel1); }
private static Grid CreateGrid(Orientation innerPanelOrientation, PanelFactory panelFactory) { Grid grid1 = new Grid(); grid1.Background = new SolidColorBrush(Colors.Orange); grid1.Margin = new Thickness(3); grid1.Width = 230; grid1.Height = 260; grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(80) }); grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid1.RowDefinitions.Add(new RowDefinition { Height = new GridLength(80) }); grid1.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); grid1.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Panel panel; if (innerPanelOrientation == Orientation.Horizontal) { panel = CreateInnerHorizontalPanel(panelFactory); } else { panel = CreateInnerVerticalPanel(panelFactory); } panel.Width = Double.NaN; panel.Height = Double.NaN; panel.VerticalAlignment = VerticalAlignment.Stretch; panel.HorizontalAlignment = HorizontalAlignment.Stretch; panel.SetValue(Grid.ColumnProperty, i); panel.SetValue(Grid.RowProperty, j); grid1.Children.Add(panel); } } return(grid1); }
private static Panel CreateInnerVerticalPanel(PanelFactory panelFactory) { Panel panel1 = panelFactory.CreatePanel(Orientation.Vertical); panel1.Background = new SolidColorBrush(Colors.Green); panel1.Margin = new Thickness(5); panel1.Height = 100; panel1.Width = 50; AddRectanglesToPanel(panel1, 20, 20); return panel1; }
private static Grid CreateGrid(Orientation innerPanelOrientation, PanelFactory panelFactory) { Grid grid1 = new Grid(); grid1.Background = new SolidColorBrush(Colors.Orange); grid1.Margin = new Thickness(3); grid1.Width = 230; grid1.Height = 260; grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(80) }); grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); grid1.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid1.RowDefinitions.Add(new RowDefinition { Height = new GridLength(80) }); grid1.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); grid1.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { Panel panel; if (innerPanelOrientation == Orientation.Horizontal) { panel = CreateInnerHorizontalPanel(panelFactory); } else { panel = CreateInnerVerticalPanel(panelFactory); } panel.Width = Double.NaN; panel.Height = Double.NaN; panel.VerticalAlignment = VerticalAlignment.Stretch; panel.HorizontalAlignment = HorizontalAlignment.Stretch; panel.SetValue(Grid.ColumnProperty, i); panel.SetValue(Grid.RowProperty, j); grid1.Children.Add(panel); } } return grid1; }