<Grid x:Name="LayoutRoot" Style="{StaticResource ContentRoot}"> <Grid ShowGridLines="True" x:Name="rootGrid" > <Style> <Setter Property="Grid.Row" Value="{Binding GridRow}" /> <Setter Property="Grid.Column" Value="{Binding GridColumn}" /> </Style> <Viewbox Grid.Column="0" Grid.Row="0"> <UniformGrid x:Name="thruster_panel_port" Margin="10"> </UniformGrid> </Viewbox> <Viewbox Grid.Column="0" Grid.Row="1"> <UniformGrid x:Name="thruster_panel_azimuth" Margin="10"> </UniformGrid> </Viewbox> <Viewbox Grid.Column="1"> <UniformGrid x:Name="thruster_panel_bridge" Grid.Column="1" > </UniformGrid> </Viewbox> <Viewbox Grid.Column="2"> <UniformGrid x:Name="thruster_panel_stdboard" Grid.Column="2" > </UniformGrid>
public class dynamic_Layout { int _gridRow; int _gridColumn; public int GridRow { get { return _gridRow; } set { _gridRow = value; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("GridRow")); } } } public int GridColumn { get { return _gridColumn; } set { _gridColumn = value; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("GridColumn")); } } } public dynamic_Layout(int columns,int rows) { this.GridColumn = columns; this.GridRow = rows; } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; #endregion } public DynamicUI() { InitializeComponent(); Loaded += new RoutedEventHandler(MainPage_Loaded); } void MainPage_Loaded(object sender, RoutedEventArgs e) { dynamic_Layout _layout = new dynamic_Layout(3,4); this.rootGrid.DataContext =_layout; CreateUI();//This metod add usercontrols to the grid , in the UniformGrids. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)