private void GGCEntregas_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "fecharegistro") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "monto") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "SustentadoMM") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "SustentadoOM") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "TotalSustentado") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Faltante") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "SustentadoMM2") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "fecha") { e.Style.Format = "MM/dd/yyyy"; } }
private void GGCVista_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Monto") { e.Style.Format = "##.00"; } }
private void GridQueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.Column == null || _iconSelectors.Count == 0) { return; } int recordIndex = RowIndexToRecordIndex(e.TableCellIdentity.RowIndex); if (recordIndex == -1) { return; } string name = e.TableCellIdentity.Column.Name; Func <T, int> fn; if (_iconSelectors.TryGetValue(name, out fn)) { var r = _grid.Table.Records[recordIndex]; if (r != null) { e.Style.ImageIndex = fn(r.GetData() as T); } } }
private void GGCVista_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Estado") { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[1].ToString() == "Baja") { e.Style.BackColor = Color.Red; e.Style.TextColor = Color.WhiteSmoke; } if (dr1 != null && dr1[1].ToString() == "Alta") { e.Style.BackColor = Color.Green; e.Style.TextColor = Color.WhiteSmoke; } } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "fecharegistro") { e.Style.Format = "MM/dd/yyyy"; } }
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.CellValueType == typeof(DateTime)) { e.Style.Format = "MM/dd/yyyy"; } }
/// <summary> /// Load the Combobox value in Localization on checkbox basis /// </summary> void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { var el = e.TableCellIdentity; var item = el.DisplayElement != null?el.DisplayElement.GetData() : null; if (item is Employee && el.Column != null && el.Column.FieldDescriptor != null && el.Column.FieldDescriptor.FieldPropertyType.IsEnum && (el.DisplayElement.Kind == DisplayElementKind.Record || el.DisplayElement.Kind == DisplayElementKind.AddNewRecord)) { var context = new TypeDescriptorContext(item, e.Style.PropertyDescriptor); var converter = e.Style.PropertyDescriptor.Converter; if (converter != null) { var contextualValues = converter.GetStandardValues(context).OfType <object>().ToArray(); e.Style.CellType = "ComboBox"; if (!checkBox1.Checked) { e.Style.DataSource = contextualValues; } } } }
/// <summary> /// Set the '+' or '-' for ParentGrid /// </summary> void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.TableCellType == GridTableCellType.NestedTableIndentCell) { if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.NestedTable) { // NestedTable GridNestedTable nt = (GridNestedTable)e.TableCellIdentity.DisplayElement; foreach (Element el in nt.ChildTable.Elements) { if (el.Kind == DisplayElementKind.Record) { if (e.TableCellIdentity.RowIndex == this.gridGroupingControl1.Table.NestedDisplayElements.IndexOf(el)) { Record r = Record.GetParentRecord(el); e.TableCellIdentity.TableCellType = GridTableCellType.RecordPlusMinusCell; e.Style.Description = r.IsExpanded ? "-" : "+"; e.Style.BorderMargins = new Syncfusion.Windows.Forms.Grid.GridMarginsInfo(3, 3, 3, 3); e.Style.Themed = false; e.Style.Enabled = true; } } } } } }
private void GGCPersLiq_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "inicio") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "fin") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Inicio2") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Fin2") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "IT") { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[8].ToString() != "") { e.Style.TextColor = Color.Crimson; e.Style.CommentTip.CommentText = e.Style.Text; e.Style.CommentTip.ForeColor = Color.Green; e.Style.CommentTip.BackColor = Color.WhiteSmoke; e.Style.CommentTip.CommentText = "Traslape con " + ((DateTime)dr1[14]).ToString("MM/dd/yyyy") + " " + ((DateTime)dr1[15]).ToString("MM/dd/yyyy") + " " + dr1[16].ToString() + " ..."; } } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Const") { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[2].ToString() == "NO") { e.Style.BackColor = Color.Red; e.Style.TextColor = Color.WhiteSmoke; } } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "inicio") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "fin") { e.Style.Format = "MM/dd/yyyy"; } }
void grid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell && e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == sortColumn) { e.Style.Tag = sortDirection; } }
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.TableCellType != GridTableCellType.AnyIndentCell && e.TableCellIdentity.DisplayElement.IsRecord()) { if (e.TableCellIdentity.ColIndex > 4) { if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 7) { e.Style.BackColor = ColorTranslator.FromHtml("#00B0F0"); e.Style.TextColor = Color.DarkOliveGreen; } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 8) { e.Style.BackColor = Color.Red; e.Style.TextColor = Color.Yellow; } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 9) { e.Style.BackColor = Color.Orange; e.Style.TextColor = Color.Brown; } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 10) { e.Style.BackColor = Color.Yellow; e.Style.TextColor = Color.Brown; } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 11) { e.Style.BackColor = ColorTranslator.FromHtml("#92D050"); e.Style.TextColor = ColorTranslator.FromHtml("#00B050"); } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 12) { e.Style.BackColor = Color.LightGreen; e.Style.BackColor = ColorTranslator.FromHtml("#92D050"); //e.Style.TextColor = Color.Brown; } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 13) { e.Style.BackColor = Color.Gold; // e.Style.TextColor = Color.Red; } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 14) { e.Style.BackColor = Color.DarkSeaGreen; // e.Style.TextColor = Color.Red; //e.Style.BackColor = Color.Brown; //e.Style.TextColor = ColorTranslator.FromHtml("#00B050"); } if (e.TableCellIdentity.DisplayElement.GetRecord().Id == 15) { e.Style.BackColor = Color.Blue; //e.Style.TextColor = Color.BurlyWood; } } } }
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { GridGroupingControl groupingControl = (GridGroupingControl)sender; Element el = e.TableCellIdentity.DisplayElement; e.Style.CellTipText = el.GetType().Name + (el.ParentElement != null ? " (Parent: " + el.ParentElement.GetType().Name + ")" : ""); if (el is ExtraSection) { if (e.Style.TableCellIdentity.ColIndex == 0) { // Row Header e.Style.CellType = ((GridTableDescriptor)el.ParentTableDescriptor).Appearance.RecordRowHeaderCell.CellType; if (el == el.ParentTable.CurrentElement) { e.Style.Text = "#"; } } else if (e.Style.TableCellIdentity.ColIndex <= el.GroupLevel) { // Group Indent e.Style.BackColor = Color.FromArgb(218, 229, 245); } else if (e.Style.TableCellIdentity.ColIndex <= extraSectionCoverCols + el.ParentTableDescriptor.GroupedColumns.Count) { // Covered area (see TableModel_QueryCoveredRange above) e.Style.BackColor = Color.FromArgb(192, 201, 219); e.Style.CellValue = "ExtraSection (" + el.ParentGroup.Name + ")"; } else if (e.Style.TableCellIdentity.ColIndex > 3) { e.Style.BackColor = Color.FromArgb(252, 172, 38); // you can get the column as follows: GridTable table = (GridTable)el.ParentTable; GridTableDescriptor td = e.TableCellIdentity.Table.TableDescriptor; GridColumnDescriptor column = td.RecordRowColumns[0, e.Style.TableCellIdentity.ColIndex - el.ParentTableDescriptor.GroupedColumns.Count - 1]; e.Style.CellValue = column.Name; // Using that column you could try and identify the summary that should be displayed in this cell. if (column.MappingName == "Freight") { // Calling this method to demonstrate different alternatives to get to the summary text e.Style.Text = GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage"); // Easier is to simple call built-in routine: e.Style.Text = GridEngine.GetSummaryText(el.ParentGroup, "SummaryRow 1", "FreightAverage"); } } } }
//if (sc.Name == e.TableCellIdentity.SummaryColumn.Name) //{ // textBox1.Text = e.Style.CellValue.ToString(); //} void gc1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { var db = new TestEntities(); #region PicturesOn if (rb1.Checked == true) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "BaseID" && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) { picture findpic = db.pictures.Find(e.Style.CellValue.ToString()); if (findpic != null) { using (var bmpTemp = new Bitmap(findpic.Path)) { image = new Bitmap(bmpTemp); e.Style.CommentTip.CommentImage = image; e.Style.CommentTip.CommentArrowColor = Color.Green; e.Style.CommentTip.CommentIndicatorColor = Color.White; } } else { e.Style.CommentTip.CommentImage = Image.FromFile(@"r:\wippictures\na.jpg"); e.Style.CommentTip.CommentArrowColor = Color.Red; e.Style.CommentTip.CommentIndicatorColor = Color.Black; } } } #endregion // int machinehrs = 0; int weldhrs = 0; int buildhrs = 0; //if (e.Style.TableCellIdentity.Column != null && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record) //{ // //switch (e.Style.TableCellIdentity.Column.Name) // //{ // // case "Machine": // // machinehrs += Convert.ToInt16(e.Style.CellValue); // // // txtMachine.Text = machinehrs.ToString(); // // break; // //} // txtMachine.Text = machinehrs.ToString(); //} }
private void GGCPersLiq_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Metrado") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Precio") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Total") { e.Style.Format = "#,##.00"; } }
/// <summary> /// Displaying limited list of operations of string columns. /// </summary> private void OnQueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { int index = Adapter.RowIndexToRecordIndex(e.TableCellIdentity.RowIndex); var field = Adapter[index]; if (field != null && field.Field.Type == AttributeType.String) { var cmnIndex = Adapter.GetColumnIndex(item => item.GroupOperation); if (cmnIndex == e.TableCellIdentity.ColIndex) { e.Style.DataSource = _stringOperations; } } }
private void GGCPersLiq_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Fecharegistro") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Monto") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Fecha") { e.Style.Format = "MM/dd/yyyy"; } }
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null) { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null) { try { var col = e.TableCellIdentity.Column.HeaderText.Split(new [] { " " }, StringSplitOptions.None); var row = e.TableCellIdentity.RowIndex - 2; var value = gridGroupingControl1.Table.Records[row][col[0]].ToString(); e.Style.CommentTip.CommentText = getNameOfVendor(value); } catch { } } } }
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { e.Style.Font.Facename = "Segoe UI"; e.Style.Font.Size = 8.25f; int lastRecIndex = this.gridGroupingControl1.Table.Records.Count; if (e.TableCellIdentity.RowIndex == lastRecIndex + 1) { e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.Black); } if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell) { e.Style.Themed = false; e.Style.BackColor = Color.White; e.Style.Borders.Top = new GridBorder(GridBorderStyle.None); e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(Form1.r, Form1.g, Form1.b), GridBorderWeight.Thick); e.Style.TextColor = Color.FromArgb(Form1.r1, Form1.g1, Form1.b1); e.Style.Text = e.TableCellIdentity.DisplayElement.ParentGroup.Category.ToString(); e.Style.TextMargins.Bottom = 8 - 3; e.Style.VerticalAlignment = GridVerticalAlignment.Bottom; } if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionPlusMinusCell) { e.Style.Borders.Top = new GridBorder(GridBorderStyle.None); e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(Form1.r, Form1.g, Form1.b), GridBorderWeight.Thick); } if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupIndentCell) { e.Style.Borders.Top = new GridBorder(GridBorderStyle.None); e.Style.Borders.Bottom = new Syncfusion.Windows.Forms.Grid.GridBorder(Syncfusion.Windows.Forms.Grid.GridBorderStyle.Solid, Color.FromArgb(Form1.r1, Form1.g1, Form1.b1), Syncfusion.Windows.Forms.Grid.GridBorderWeight.ExtraThin); } if (e.Style.CellType == "ColumnHeaderCell") { e.Style.Borders.All = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(Form1.r, Form1.g, Form1.b), GridBorderWeight.Thin); e.Style.CellTipText = e.Style.Text; e.Style.HorizontalAlignment = GridHorizontalAlignment.Left; e.Style.Interior = new BrushInfo(GradientStyle.Vertical, Color.White, Color.FromArgb(Form1.r, Form1.g, Form1.b)); } }
private void GGCPersLiq_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Certificado") { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[2].ToString() == "NO") { e.Style.BackColor = Color.Red; e.Style.TextColor = Color.WhiteSmoke; } } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "FechaExpedicion") { e.Style.Format = "MM/dd/yyyy"; } }
private void GGCVista_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.TableCellType != GridTableCellType.ColumnHeaderCell) { if (e.Style.CellValue != null && e.Style.Text != "") { if (e.TableCellIdentity.ColIndex != 0) { if (e.TableCellIdentity.DisplayElement.ParentRecord != null) { DataRowView dr = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr != null && Convert.ToInt16(dr[3].ToString()) != 0) { e.Style.BackColor = Color.Green; e.Style.TextColor = Color.WhiteSmoke; } } } } } }
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Style; if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { if (e.TableCellIdentity.Column.FieldDescriptor.FieldPropertyType == typeof(string)) { return; } { // Get the value from column "1" and color all cells in record based // on this value. Record r = e.Style.TableCellIdentity.DisplayElement.GetRecord(); object value = r.GetValue("1"); int v = Convert.ToInt32(value) % colors.Length; e.Style.BackColor = colors[v]; } } }
private void GGCProyectos_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Estado") { if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[1].ToString() == "En Trabajo") { e.Style.BackColor = Color.Green; e.Style.TextColor = Color.WhiteSmoke; } } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Proyectado") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Fecha") { e.Style.Format = "MM/dd/yyyy"; } }
void gc1_QueryCellText(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.TableCellType == GridTableCellType.SummaryFieldCell) { foreach (var summaryRow in this.gc1.TableDescriptor.SummaryRows) { foreach (var sc in summaryRow.SummaryColumns) { switch (sc.Name) { case "Weld Hours Remaining": txtWeld.Text = e.Style.CellValue.ToString(); break; case "Machine Hours Remaining": // txtMachine.Text = e.Style.CellValue.ToString(); break; case "Build Hours Remaining": txtBuild.Text = e.Style.CellValue.ToString(); break; case "Tracker Hours Remaining": txtTrackers.Text = e.Style.CellValue.ToString(); break; case "Design Hours Remaining": txtDesign.Text = e.Style.CellValue.ToString(); break; default: break; } } } } }
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.TableCellType != GridTableCellType.ColumnHeaderCell) { if (e.TableCellIdentity.ColIndex == 2) { e.Style.BackColor = Color.LightBlue; } if (e.TableCellIdentity.ColIndex == 4) { e.Style.Format = "0.00"; } if (e.TableCellIdentity.ColIndex == 4 || e.TableCellIdentity.ColIndex == 3) { e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; } else { e.Style.HorizontalAlignment = GridHorizontalAlignment.Left; } } }
void grid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (!this.Visible) { return; } if (findAll) { DataRowView dr = e.TableCellIdentity.DisplayElement.GetData() as DataRowView; int rowIndex, colIndex; grid.TableControl.CurrentCell.GetCurrentCell(out rowIndex, out colIndex); GridRangeInfo range = grid.TableControl.Selections.Ranges.ActiveRange; if (cmbOptions.Text.Equals("WholeTable") && dr != null) { if (e.Style.Text.Equals(txtSearch.Text) && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { e.Style.BackColor = Color.Orange; } } else if (cmbOptions.Text.Equals("ColumnOnly") && dr != null) { if (e.TableCellIdentity.ColIndex == colIndex) { if (e.Style.Text.Equals(txtSearch.Text)) { e.Style.BackColor = Color.Orange; } } } } else if (resetAll) { e.Style.BackColor = SystemColors.Window; } }
//Setting cell type as static for child tables plusminus cell which does nt havae child records void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell) { Element cell = e.TableCellIdentity.DisplayElement; Record r = cell.ParentRecord as Record; bool makeStatic = true; if (r != null && r.NestedTables.Count > 0) { foreach (NestedTable nt in r.NestedTables) { if (nt.ChildTable.GetFilteredRecordCount() != 0) { makeStatic = false; } } } if (makeStatic) { e.Style.CellType = "Static"; e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(208, 215, 229)); } } }
protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { try { if (e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.MappingName == "Name" && (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)) { processName = e.Style.CellValue.ToString(); } if (e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.MappingName == "Functional Area" && (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)) { functionalArea = e.Style.CellValue.ToString(); } if (e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.MappingName == "Status" && (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)) { e.Style.CellType = "Image"; //TODO make a better (external) lookup switch (e.Style.CellValue.ToString()) { case "-1": case "0": case "1": case "6": case "7": case "12": e.Style.ImageIndex = imageList.Images.IndexOfKey("grey"); break; case "8": e.Style.ImageIndex = imageList.Images.IndexOfKey("green"); break; case "9": case "11": e.Style.ImageIndex = imageList.Images.IndexOfKey("yellow"); break; case "10": e.Style.ImageIndex = imageList.Images.IndexOfKey("red"); break; case "2": case "3": case "4": case "5": e.Style.ImageIndex = imageList.Images.IndexOfKey("blue"); break; } e.Style.Text = String.Empty; e.Style.ImageSizeMode = Syncfusion.Windows.Forms.Grid.GridImageSizeMode.AutoSize; e.Style.HorizontalAlignment = Syncfusion.Windows.Forms.Grid.GridHorizontalAlignment.Center; } if (e.TableCellIdentity.Column != null) { switch (e.TableCellIdentity.Column.MappingName) { case "Expected Start Time": case "Expected Completion Time": case "Total": case "Success": case "Failed": case "SLA": case "Status": e.Style.HorizontalAlignment = Syncfusion.Windows.Forms.Grid.GridHorizontalAlignment.Center; e.Style.TextAlign = Syncfusion.Windows.Forms.Grid.GridTextAlign.Right; break; } } } catch (Exception ex ) { log.Warn(ex); } }
/// <summary> /// Set the texr in CellTip /// </summary> private void groupingGrid1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { e.Style.CellTipText = e.TableCellIdentity.Info; }
private void GGCPersLiq_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Experiencia") { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[7].ToString() == "SI") { e.Style.BackColor = Color.Green; e.Style.TextColor = Color.WhiteSmoke; } } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Estudios") { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[8].ToString() == "SI") { e.Style.BackColor = Color.Green; e.Style.TextColor = Color.WhiteSmoke; } } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Sust") { //Setting the comment tip text if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[9].ToString() == "NO") { e.Style.BackColor = Color.Red; e.Style.TextColor = Color.WhiteSmoke; } } } if (e.TableCellIdentity.DisplayElement != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) { DataRowView dr1 = e.TableCellIdentity.DisplayElement.ParentRecord.GetData() as DataRowView; if (dr1 != null && dr1[17].ToString() == "1") { e.Style.BackColor = Color.Red; e.Style.TextColor = Color.WhiteSmoke; } } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "IniActividades") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "fecharegistro") { e.Style.Format = "MM/dd/yyyy"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "Monto") { e.Style.Format = "#,##.00"; } if (e.Style.TableCellIdentity.Column != null && e.Style.TableCellIdentity.Column.Name == "capacidadmaximacontratacion") { e.Style.Format = "#,##.00"; } }