private void CreateControls() { Grid grid_main = new Grid(); grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid_main.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100.0, GridUnitType.Star) }); 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; grid_main.SetGridRowColumn(m_comboBox_location, 0, 0); m_image_locationFile = new Image(); m_image_locationFile.Drop += Image_LocationFile_Drop; grid_main.SetGridRowColumn(m_image_locationFile, 1, 0); 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; }