Ejemplo n.º 1
0
        // QueryCellInfo even is hooked to set the values.
        private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
        {
            switch (e.TableCellIdentity.TableCellType)
            {
            case GridTableCellType.RecordPreviewCell:
            {
                GridGroupingControl groupingControl = (GridGroupingControl)sender;
                GridTable           table           = groupingControl.Table;
                GridRecord          record          = e.TableCellIdentity.DisplayElement.ParentRecord as GridRecord;
                if (record != null)
                {
                    e.Style.CellValue = record.GetValue("Notes").ToString();
                }
                else
                {
                    e.Style.CellValue = "No Notes.";
                }
                break;
            }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(e.TableCellIdentity.Info);

            if (e.Style != null)
            {
                sb.AppendFormat("\r\nCellType = {0}", e.Style.CellType);
                sb.AppendFormat(", CellValueType = {0}", e.Style.CellValueType);
                sb.AppendFormat(", nFormat = \"{0}\"", e.Style.Format);
                sb.AppendFormat(", CellValue = \"{0}\"", e.Style.CellValue);
                sb.AppendFormat(", ImageSizeMode = \"{0}\"", e.Style.ImageSizeMode);
            }
            e.Style.CellTipText = sb.ToString();
        }
Ejemplo n.º 2
0
        //Used to setup the cell-specific formatting information
        private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
        {
            switch (e.TableCellIdentity.TableCellType)
            {
            case GridTableCellType.RecordPreviewCell:
            {
                GridGroupingControl groupingControl = (GridGroupingControl)sender;
                GridTable           table           = groupingControl.Table;
                GridRecord          record          = (GridRecord)e.TableCellIdentity.DisplayElement.ParentRecord;
                e.Style.CellValue = record.GetValue("Notes").ToString();
                break;
            }

            case GridTableCellType.AlternateRecordFieldCell:
            case GridTableCellType.AddNewRecordFieldCell:
            case GridTableCellType.RecordFieldCell:
            {
                GridTable  table     = e.TableCellIdentity.Table;
                string     tableName = table.TableDescriptor.Name;
                GridRecord record    = (GridRecord)e.TableCellIdentity.DisplayElement.ParentRecord;
                object     recordkey = record.PrimaryKeys[0];
                string     fieldName = e.TableCellIdentity.Column.MappingName;

                GridStyleInfo style = GetCellStyle(tableName, recordkey, fieldName);
                if (style != null)
                {
                    e.Style.ModifyStyle(style, Syncfusion.Styles.StyleModifyType.Override);
                }
                break;
            }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(e.TableCellIdentity.Info);

            if (e.Style != null)
            {
                sb.AppendFormat("\r\nCellType = {0}", e.Style.CellType);
                sb.AppendFormat(", CellValueType = {0}", e.Style.CellValueType);
                sb.AppendFormat(", nFormat = \"{0}\"", e.Style.Format);
                sb.AppendFormat(", CellValue = \"{0}\"", e.Style.CellValue);
                sb.AppendFormat(", ImageSizeMode = \"{0}\"", e.Style.ImageSizeMode);
            }

            e.Style.CellTipText = sb.ToString();
        }