private void cboChooseTable_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (cboChooseTable.SelectedIndex > 0) { if (cboChooseTable.SelectedIndex == 1) { tableSelected = TableSelected.Building; } if (cboChooseTable.SelectedIndex == 2) { tableSelected = TableSelected.User; } if (cboChooseTable.SelectedIndex == 3) { tableSelected = TableSelected.Log; } if (cboChooseTable.SelectedIndex == 4) { tableSelected = TableSelected.Contact; } } }
//Method to set the state of the ComboBox Selection - For Selected Table private void cboChooseTable_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Check that an option has been selected //the selected index will be 0 if an option has been selected //if (cboChooseTable.SelectedIndex == 1) //{ if (cboChooseTable.SelectedIndex > 0) { if (cboChooseTable.SelectedIndex == 1) { tableSelected = TableSelected.Pitch; } if (cboChooseTable.SelectedIndex == 2) { tableSelected = TableSelected.User; } if (cboChooseTable.SelectedIndex == 3) { tableSelected = TableSelected.Log; } //} } }
protected virtual void OnTableSelected(TableEventArgs args) { TableSelected?.Invoke(this, args); }
private void OkayButton_Click(object sender, RoutedEventArgs e) { var color = (Color)ColorConverter.ConvertFromString(cbBorder.SelectedValue.ToString()); var bgcolor = (Color)ColorConverter.ConvertFromString(cbBGColor.SelectedValue.ToString()); var brush = new SolidColorBrush(color); var backBrush = new SolidColorBrush(bgcolor); var alignment = AlignmentSelection.SelectedValue.ToString(); Table table = new Table(); int numberOfColumns = 0; int numberOfRows = 0; TableRowGroup tableRowGroup = new TableRowGroup(); if (!string.IsNullOrEmpty(txtSpacing.Text)) { table.CellSpacing = Convert.ToDouble(txtSpacing.Text); } if (!string.IsNullOrEmpty(txtPadding.Text)) { table.Padding = new Thickness(Convert.ToDouble(txtPadding.Text)); } if (!string.IsNullOrEmpty(txtColumns.Text)) { numberOfColumns = Convert.ToInt32(txtColumns.Text); } if (!string.IsNullOrEmpty(txtColumns.Text)) { numberOfRows = Convert.ToInt32(txtRows.Text); } for (int y = 0; y < numberOfRows; y++) { TableRow row = new TableRow(); for (int x = 0; x < numberOfColumns; x++) { TableCell cell = new TableCell(); cell.BorderBrush = brush; cell.BorderThickness = new Thickness(0.5); row.Cells.Add(cell); row.Background = backBrush; } tableRowGroup.Rows.Add(row); } table.RowGroups.Add(tableRowGroup); table.BorderBrush = brush; table.BorderThickness = new Thickness(1); table.Background = backBrush; switch (alignment) { case "Right": table.TextAlignment = TextAlignment.Right; break; case "Left": table.TextAlignment = TextAlignment.Left; break; case "Center": table.TextAlignment = TextAlignment.Center; break; case "Justify": table.TextAlignment = TextAlignment.Justify; break; } TableSelected.Invoke(table); editorDataContext.contextMenuUC.StaysOpen = false; editorDataContext.contextMenuUC.IsOpen = false; }