/// <summary> /// Creates the WPF elements for displaying the top row /// </summary> private void CreateControlRow(int level) { //create the top row grid, set it to row 0 and add it to the main grid Grid topRowGrid = new Grid(); Grid.SetRow(topRowGrid, level); mainGrid.Children.Add(topRowGrid); //add columns to the base grid for (int i = 0; i < 2; i++) { ColumnDefinition col = new ColumnDefinition(); col.Width = new GridLength(1, GridUnitType.Star); topRowGrid.ColumnDefinitions.Add(col); } //set the thrid col to only take up as much room as button width ColumnDefinition col1 = new ColumnDefinition(); col1.Width = new GridLength(1, GridUnitType.Auto); topRowGrid.ColumnDefinitions.Add(col1); //create and attach the textbox alarmText = new TextBlock(); Grid.SetColumn(alarmText, 0); alarmText.TextAlignment = TextAlignment.Center; alarmText.Text = storedAlarm.GetAlarmTime().ToShortTimeString(); topRowGrid.Children.Add(alarmText); //create and attach the button editBtn = new Button(); editBtn.Background = null; editBtn.BorderBrush = null; Grid.SetColumn(editBtn, 2); editBtn.FontFamily = new FontFamily("Segoe UI Symbol"); //editBtn.Width = 20; editBtn.Content = '\uE104'; button = new Button(); Grid.SetColumn(button, 1); button.Click += ButtonClick; //!this assigns the event handler editBtn.Click += EditBtnClick; button.BorderThickness = new Thickness(1, 1, 1, 1); button.BorderBrush = Brushes.DarkGray; topRowGrid.Children.Add(button); topRowGrid.Children.Add(editBtn); //set the button to the correct mode (as a default) if (storedAlarm.IsRinging) { this.SetDismiss(); } else { this.SetCancel(); } }
/// <summary> /// Creates the WPF elements for displaying the top row /// </summary> private void CreateTopRow() { //create the top row grid, set it to row 0 and add it to the main grid Grid topRowGrid = new Grid(); Grid.SetRow(topRowGrid, 0); mainGrid.Children.Add(topRowGrid); //add columns to the base grid for (int i = 0; i < 2; i++) { ColumnDefinition col = new ColumnDefinition(); col.Width = new GridLength(1, GridUnitType.Star); topRowGrid.ColumnDefinitions.Add(col); } //create and attach the textbox TextBlock textBox = new TextBlock(); Grid.SetColumn(textBox, 0); textBox.TextAlignment = TextAlignment.Center; textBox.Text = storedAlarm.GetAlarmTime().ToShortTimeString(); topRowGrid.Children.Add(textBox); //create and attach the button button = new Button(); Grid.SetColumn(button, 1); button.Click += ButtonClick; //!this assigns the event handler button.BorderThickness = new Thickness(1, 1, 1, 1); button.BorderBrush = Brushes.DarkGray; topRowGrid.Children.Add(button); //set the button to the correct mode (as a default) if (storedAlarm.IsRinging) { this.SetDismiss(); } else { this.SetCancel(); } }