private void CreateControls() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // Area Grid Grid grid_area = new Grid(); grid_area.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_area.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100.0, GridUnitType.Star) }); grid_main.SetGridRowColumn(grid_area, 0, 0); //////// // Area m_comboBox_area = new ComboBox_Area(); m_comboBox_area.SetActiveAndRegisterForGinTubEvents(); // never unregister; we want updates no matter where we are m_comboBox_area.SelectionChanged += ComboBox_Area_SelectionChanged; Label label_area = new Label() { Content = "Area:", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; grid_area.SetGridRowColumn(m_comboBox_area, 1, 0); grid_area.SetGridRowColumn(label_area, 0, 0); //////// // Room m_groupBox_room = new GroupBox() { Header = "Room:" }; grid_main.SetGridRowColumn(m_groupBox_room, 1, 0); //////// // Time m_userControl_timeSpan = new UserControl_TimeSpan(GameStateOnInitialLoadTime); grid_main.SetGridRowColumn(m_userControl_timeSpan, 2, 0); m_userControl_timeSpan.TimeChangedEvent += UserControl_TimeSpan_TimeChanged; //////// // Fin Content = grid_main; }
private void CreateControls() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); //////// // Id Grid Grid grid_id = new Grid(); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_main.SetGridRowColumn(grid_id, 0, 0); //////// // Id TextBlock textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, Text = (RoomStateId.HasValue) ? RoomStateId.ToString() : "NewRoomState" }; Label label_roomId = new Label() { Content = "Id:", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; grid_id.SetGridRowColumn(textBlock_id, 0, 1); grid_id.SetGridRowColumn(label_roomId, 0, 0); //////// // State Grid Grid grid_state = new Grid(); grid_state.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_state.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid_main.SetGridRowColumn(grid_state, 1, 0); //////// // State m_textBox_state = new TextBox() { VerticalAlignment = VerticalAlignment.Center }; m_textBox_state.TextChanged += TextBox_State_TextChanged; SetRoomStateState(RoomStateState); Label label_state = new Label() { Content = "State:", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center }; grid_state.SetGridRowColumn(m_textBox_state, 0, 1); grid_state.SetGridRowColumn(label_state, 0, 0); //////// // Location StackPanel stackPanel_location = new StackPanel() { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center }; grid_main.SetGridRowColumn(stackPanel_location, 2, 0); Label label_location = new Label() { Content = "Location: ", FontWeight = FontWeights.Bold }; stackPanel_location.Children.Add(label_location); m_comboBox_location = new ComboBox_Location(); m_comboBox_location.SetActiveAndRegisterForGinTubEvents(); // never unregister; we want updates no matter where we are m_comboBox_location.SelectionChanged += ComboBox_Location_SelectionChanged; stackPanel_location.Children.Add(m_comboBox_location); //////// // Time m_userControl_timeSpan = new UserControl_TimeSpan(RoomStateTime); grid_main.SetGridRowColumn(m_userControl_timeSpan, 3, 0); m_userControl_timeSpan.TimeChangedEvent += UserControl_TimeSpan_TimeChanged; //////// // Fin Content = grid_main; }