public static void SetButtonText(UltraGridRow row, GridButton button) { var colName = button.ToString(); var label = button.ToString(); if (row.Cells.IndexOf(colName) == -1) return; var buttonLabel = !string.IsNullOrEmpty(label) ? string.Format("[{0}]", label.ToLower()) : string.Empty; row.Cells[colName].Value = buttonLabel; }
public static void AddColumnButton(UltraGrid grid, int band, GridButton button) { var colName = button.ToString(); var colWidth = button == GridButton.Edit || button == GridButton.Add ? 34 : button == GridButton.Delete ? 46 : button == GridButton.Override ? 60 : 50; if (grid.DisplayLayout.Bands[band].Columns.IndexOf(colName) != -1) return; grid.DisplayLayout.Bands[band].Columns.Insert(grid.DisplayLayout.Bands[band].Columns.Count, colName); var gridColumn = grid.DisplayLayout.Bands[band].Columns[colName]; gridColumn.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always; gridColumn.CellAppearance.TextHAlign = HAlign.Center; gridColumn.CellAppearance.FontData.Name = "Tahoma"; gridColumn.CellAppearance.FontData.SizeInPoints = 8f; gridColumn.CellActivation = Activation.NoEdit; gridColumn.CellClickAction = CellClickAction.CellSelect; gridColumn.Header.Caption = ""; gridColumn.Header.Enabled = false; gridColumn.RowLayoutColumnInfo.PreferredCellSize = new Size(colWidth, 18); gridColumn.Style = ColumnStyle.Button; }
public static void RemoveColumnButton(UltraGrid grid, int band, GridButton button) { var colName = button.ToString(); var idx = grid.DisplayLayout.Bands[band].Columns.IndexOf(colName); if (idx != -1) grid.DisplayLayout.Bands[band].Columns.Remove(idx); }