private void GridSupplier_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (_listOfSupplier.Count > 0) { if (e.RowIndex > 0) { var rowIndex = e.RowIndex - 1; if (rowIndex < _listOfSupplier.Count) { var supplier = _listOfSupplier[rowIndex]; switch (e.ColIndex) { case 2: e.Style.CellValue = supplier.nama_supplier; break; case 3: e.Style.CellValue = supplier.alamat; break; default: break; } // we handled it, let the grid know e.Handled = true; } } } }
/// <summary> /// Handles the QueryCellInfo event of the Model control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs"/> instance containing the event data.</param> void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs args) { var viewModel = this.AssociatedObject.DataContext as ViewModel; if (args.Cell.RowIndex != 0) { GridDataStyleInfo style = args.Style as GridDataStyleInfo; if (style.CellIdentity.TableCellType == GridDataTableCellType.GroupCaptionCell) { if (args.Style.CellValue != null) { string country = style.CellIdentity.Group.Key.ToString(); var pathLoc = viewModel.ProductsDetails.Where(o => o.Suppliers.Country == country); if (pathLoc.Count() > 0) { var countryPath = pathLoc.ElementAt(0).Suppliers.Country; args.Style.CellValue2 = "Images/" + countryPath + ".png"; args.Style.CellType = "DataBoundTemplate"; args.Style.CellItemTemplateKey = "sampleTemplate"; } } } } }
private void Gridcontrol_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { e.Style.CellValue = string.Format("{0},{1}", e.Cell.RowIndex, e.Cell.ColumnIndex); e.Style.ShowTooltip = true; //Show tooltip for a specific index if (e.Cell.RowIndex == 1 && e.Cell.ColumnIndex == 1) { e.Style.ToolTip = " Grid (" + e.Cell.RowIndex + "," + e.Cell.ColumnIndex + ") "; } else { e.Style.ToolTip = e.Style.CellValue; } //Show tooltip for row. if (e.Cell.ColumnIndex > 0 && e.Cell.RowIndex == 5) { e.Style.ToolTip = " Row " + "(" + e.Cell.RowIndex + "," + e.Cell.ColumnIndex + ") "; } // Show tooltip for column. if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex == 4) { e.Style.ToolTip = " Col " + "(" + e.Cell.RowIndex + "," + e.Cell.ColumnIndex + ") "; } }
/// <summary> /// Handles the QueryCellInfo event of the Model control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs"/> instance containing the event data.</param> void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { var style = e.Style as GridDataStyleInfo; if (style != null && !style.IsEmpty) { if (style.CellIdentity != null && style.CellIdentity.Column != null && style.CellIdentity.Column.MappingName == "PopulationDensity") { var record = style.CellIdentity.Record as CountryDetails; if (record != null) { style.CellValue = record.Population / record.Area; } } if (style.CellIdentity != null && style.CellIdentity.Column != null && style.CellIdentity.Column.MappingName == "PopulationPercentage1") { var record = style.CellIdentity.Record as CountryDetails; if (record != null) { style.CellValue = record.PopulationPercentage + " % " + record.Population + " of 6965000000"; } } } }
private void QyeryCellInfo(object sender, GridQueryCellInfoEventArgs e) { var CurrentNod = this.AssociatedObject.InternalGrid.GetNodeAtRowIndex(e.Cell.RowIndex); var curCell = this.AssociatedObject.InternalGrid.CurrentCell; if (CurrentNod != null) { if (CurrentNod.Item is ITreeNode) { if ((CurrentNod.Item as ITreeNode).IsGroup) { e.Style.Font = new GridFontInfo { FontWeight = System.Windows.FontWeights.SemiBold }; if (e.Cell.ColumnIndex == 1) { e.Style.Foreground = Brushes.Black; e.Style.ShowTooltip = true; } } } if (CurrentNod.Item is MenuRight) { if (e.Cell.ColumnIndex > 2 && this.AssociatedObject.Columns.Count >= e.Cell.ColumnIndex) { FormMenu fm = (CurrentNod.Item as MenuRight).AppMenu; byte val = (byte)fm.GetType().GetProperty(this.AssociatedObject.Columns[e.Cell.ColumnIndex - 1].MappingName).GetValue(fm); if (val == 0) { e.Style.CellItemTemplate = e.Style.CellEditTemplate = this.AssociatedObject.FindResource("EmptyTemplate") as DataTemplate; } } } } }
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { Dictionary <RowColumnIndex, object> committedValues = this.AssociatedObject.DataContext as Dictionary <RowColumnIndex, object>; if (committedValues != null) { if (e.Cell.RowIndex == 0) { if (e.Cell.ColumnIndex > 0) { e.Style.CellValue = e.Cell.ColumnIndex; } } else if (e.Cell.RowIndex > 0) { if (e.Cell.ColumnIndex == 0) { e.Style.CellValue = e.Cell.RowIndex; } else if (e.Cell.ColumnIndex > 0) { if (committedValues.ContainsKey(e.Cell)) { e.Style.CellValue = committedValues[e.Cell]; } else { e.Style.CellValue = String.Format("{0}/{1}", e.Cell.RowIndex, e.Cell.ColumnIndex); } } } } }
protected override void OnQueryCellInfo(GridQueryCellInfoEventArgs e) { var columnIndex = e.Cell.ColumnIndex - Model.HeaderColumns; if (e.Cell.RowIndex < Model.HeaderRows) { if (ColumnNames != null) { e.Style.CellValue = ColumnNames[columnIndex]; } return; } var rowIndex = e.Cell.RowIndex - Model.HeaderRows; if (rowIndex >= 0 && columnIndex >= 0) { var columnId = ViewModel.GetColumnId(columnIndex); IViewModelAccessor accessor; if (_viewModelAccessors.TryGetValue(columnId, out accessor)) { accessor.SetCellValue(e.Style, rowIndex, columnIndex); // TODO: move cell rendering to custom cell renderers if (accessor.Type == typeof(bool)) { e.Style.CellType = "CheckBox"; e.Style.IsThreeState = false; } } } }
private void SetExcelLikeUI(GridQueryCellInfoEventArgs e) { if (e.Style.RowIndex == 0 && e.Style.ColumnIndex == 0) { #if !GraphicCellDomo e.Style.Background = new SolidColorBrush(Colors.White); e.Style.Font.FontWeight = FontWeights.Bold; #endif return; } else if (e.Style.RowIndex == 0) { e.Style.CellValue = GridRangeInfo.GetAlphaLabel(e.Cell.ColumnIndex); #if !GraphicCellDomo e.Style.Background = new SolidColorBrush(Colors.White); #endif e.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; e.Style.VerticalAlignment = VerticalAlignment.Center; return; } else if (e.Style.ColumnIndex == 0) { e.Style.CellValue = e.Style.RowIndex; #if !GraphicCellDomo e.Style.Background = new SolidColorBrush(Colors.White); #endif e.Style.Foreground = new SolidColorBrush(Colors.Black); e.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; } }
private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Cell.RowIndex == 0 || e.Cell.ColumnIndex == 0) { e.Style.CellValue = "R" + e.Cell.RowIndex + ", C" + e.Cell.ColumnIndex; } }
/// <summary> /// Handles the QueryCellInfo event of the Model control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs"/> instance containing the event data.</param> void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e != null && e.Style != null) { e.Style.ShowTooltip = true; } }
private void GridJenisPengeluaran_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (_listOfJenisPengeluaran.Count > 0) { if (e.RowIndex > 0) { var rowIndex = e.RowIndex - 1; if (rowIndex < _listOfJenisPengeluaran.Count) { var jenisPengeluaran = _listOfJenisPengeluaran[rowIndex]; switch (e.ColIndex) { case 2: e.Style.CellValue = jenisPengeluaran.nama_jenis_pengeluaran; break; default: break; } // we handled it, let the grid know e.Handled = true; } } } }
/// <summary> /// Handles the QueryCellInfo event of the InternalGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs"/> instance containing the event data.</param> void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { e.Style.HorizontalAlignment = HorizontalAlignment.Left; if ((e.Style.ColumnIndex >= 5 && e.Style.ColumnIndex <= 9) && e.Style.CellType != "SortHeader") { e.Style.HorizontalAlignment = HorizontalAlignment.Right; } var currentNode = this.AssociatedObject.InternalGrid.GetNodeAtRowIndex(e.Cell.RowIndex); if (currentNode != null && currentNode.HasChildNodes) { e.Style.ImageContentStretch = ImageContentStretch.Uniform; e.Style.Font = new GridFontInfo { FontWeight = FontWeights.Bold }; e.Style.ReadOnly = true; if (e.Style.ColumnIndex == 1) { e.Style.Font.FontSize = 14; e.Style.Foreground = Brushes.Black; } else if (e.Style.ColumnIndex > 1) { e.Style.Foreground = Brushes.Gray; } } else { e.Style.VerticalAlignment = VerticalAlignment.Center; } }
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 0) { int j = GetColorID(GridRangeInfo.Cell(e.Cell.RowIndex, e.Cell.ColumnIndex)); e.Style.Background = (j == -1) ? e.Style.Background = new SolidColorBrush(Color.FromArgb(255, 00, 59, 81)) : colorCollection[j]; } for (int i = 1; i < 8; i++) { if (e.Style.RowIndex == 0 && e.Style.ColumnIndex == i) { int n = 64; String s = ((char)((int)n + i)).ToString(); e.Style.CellValue = s; } } for (int i = 1; i < 11; i++) { if (e.Style.RowIndex == i && e.Style.ColumnIndex == 0) { e.Style.CellValue = i; } } if (e.Style.RowIndex > 0 && e.Style.ColumnIndex > 0) { e.Style.CellValue = (isDataBaseRelated) ? dbDT.Rows[e.Cell.RowIndex - 1][e.Cell.ColumnIndex - 1] : dt.Rows[e.Cell.RowIndex - 1][e.Cell.ColumnIndex - 1]; } }
/// <summary> /// Handles the QueryCellInfo event of the InternalGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs"/> instance containing the event data.</param> void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if ((e.Style.ColumnIndex == 3 || e.Style.ColumnIndex == 5) && e.Style.CellType != "SortHeader") { e.Style.HorizontalAlignment = HorizontalAlignment.Right; e.Style.VerticalAlignment = VerticalAlignment.Center; } var currentNode = this.AssociatedObject.InternalGrid.GetNodeAtRowIndex(e.Cell.RowIndex); if (currentNode != null) { if (!currentNode.HasChildNodes) { e.Style.ShowTooltip = true; e.Style.TooltipTemplateKey = "myTooltipTemplate"; } } if (currentNode != null) { e.Style.CellValue2 = currentNode.Item; } if (currentNode != null && currentNode.HasChildNodes) { e.Style.Font = new GridFontInfo { FontWeight = FontWeights.Bold }; e.Style.ReadOnly = true; } }
private void GridProduk_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (_listOfProduk.Count > 0) { if (e.RowIndex > 0) { var rowIndex = e.RowIndex - 1; if (rowIndex < _listOfProduk.Count) { var produk = _listOfProduk[rowIndex]; switch (e.ColIndex) { case 2: e.Style.CellValue = produk.kode_produk; break; case 3: e.Style.CellValue = produk.nama_produk; break; default: break; } // we handled it, let the grid know e.Handled = true; } } } }
void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Style.ColumnIndex == 0 || e.Style.RowIndex == 0) { e.Style.CellType = "DataBoundTemplate"; e.Style.CellItemTemplateKey = "TextBlocktemplate"; if (e.Style.RowIndex == 0) { e.Style.CellValue = dataTable.Columns[e.Style.ColumnIndex]; } else { e.Style.CellValue = dataTable.Rows[e.Style.RowIndex][e.Style.ColumnIndex]; } } else { e.Style.CellValue = dataTable.Rows[e.Style.RowIndex][e.Style.ColumnIndex]; e.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; e.Style.VerticalAlignment = System.Windows.VerticalAlignment.Center; e.Style.DataValidationTooltip = " " + dataTable.Rows[e.Style.RowIndex][0].ToString() + ": \n Population rate in " + dataTable.Columns[e.Style.ColumnIndex] + " is " + e.Style.CellValue.ToString(); e.Style.ShowDataValidationTooltip = true; } }
void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { e.Style.Font.Facename = "Segoe UI"; e.Style.Font.Size = 10f; if (e.RowIndex == 0 && e.ColIndex > 0) { e.Style.CellValue = dataTable.Columns[e.ColIndex].ColumnName; } else if (e.RowIndex > 0 && e.ColIndex >= 0) { e.Style.CellValue = dataTable.Rows[e.RowIndex][e.ColIndex]; if (e.ColIndex > 0) { string comment = " " + dataTable.Rows[e.RowIndex][0].ToString() + ": \n Population rate in " + dataTable.Columns[e.ColIndex] + " is " + e.Style.CellValue.ToString(); e.Style.CommentTip.CommentText = comment; e.Style.CommentTip.CommentWindowSize = new Size(100, 50); if (e.ColIndex % 2 == 0) { e.Style.CommentTip.CommentIndicatorColor = Color.Green; } } } if (e.ColIndex == 0 && e.RowIndex == 0) { e.Style.CellValue = dataTable.Columns[0].ColumnName; } }
private void GridCustomer_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (_listOfCustomer.Count > 0) { if (e.RowIndex > 0) { e.Style.Font = new GridFontInfo(new Font("Arial", 14f)); var rowIndex = e.RowIndex - 1; if (rowIndex < _listOfCustomer.Count) { var customer = _listOfCustomer[rowIndex]; switch (e.ColIndex) { case 2: e.Style.CellValue = customer.nama_customer; break; case 3: e.Style.CellValue = customer.alamat; break; default: break; } // we handled it, let the grid know e.Handled = true; } } } }
/// <summary> /// First 3 columns are filled virtually - changes are ignored. The other columns /// are saved and loaded from GridData object. /// </summary> /// <param name="e"></param> protected override void OnQueryCellInfo(GridQueryCellInfoEventArgs e) { base.OnQueryCellInfo(e); if (!e.Handled) { if (e.ColIndex >= 0 && e.RowIndex > 0) { if (e.ColIndex < 3) { int part = (4 - e.ColIndex) * 5 ^ 2; int num = e.RowIndex / part; e.Style.CellValue = num; e.Style.CellType = "CustomCell"; e.Style.CellAppearance = GridCellAppearance.Raised; e.Handled = true; } else if (e.ColIndex == 3) { e.Style.CellValue = e.RowIndex / 30; e.Handled = true; } } } }
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { var dataContext = AssociatedObject.DataContext as ExcelImportViewModel; if (dataContext != null) { SetExcelLikeUI(e); if (e.Cell.RowIndex <= 0 || e.Cell.ColumnIndex <= 0) { return; } GridModel gridModel = sender as GridModel; if (!e.Style.IsChanged && e.Style.IsEmpty) { int index = dataContext.ActiveTabIndex; IWorksheet sheet = dataContext.Workbook.Worksheets[index]; if (sheet != null) { IRange range = sheet.Range; if (e.Cell.RowIndex >= range.Row && e.Cell.ColumnIndex >= range.Column) { IRange rangeToConvert = sheet.Range[e.Cell.RowIndex, e.Cell.ColumnIndex]; GridModelImportExtensions.ConvertExcelRangeToVirtualGrid(e.Style, sheet, rangeToConvert, null); if (gridModel != null && e.Style.FormulaTag == null) { string s = e.Style.Text; if (s.Length > 0 && s[0] == '=') { s = s.Substring(1); try { gridModel.FormulaEngine.FormulaContextCell = GridRangeInfo.GetAlphaLabel(e.Cell.ColumnIndex) + e.Cell.RowIndex.ToString(); e.Style.FormulaTag = new GridFormulaTag(gridModel.FormulaEngine.Parse(s), null, e.Cell.RowIndex, e.Cell.ColumnIndex); string cellvalue = rangeToConvert.DisplayText; e.Style.FormulaTag.Text = cellvalue; } catch (Exception ex) { e.Style.FormulaTag = new GridFormulaTag(ex.Message, ex.Message, e.Cell.RowIndex, e.Cell.ColumnIndex); } } } gridModel.Data[e.Cell.RowIndex, e.Cell.ColumnIndex] = e.Style.Store; } } } else { // To save the modified value. int index = dataContext.ActiveTabIndex; IWorksheet changedSheet = dataContext.Workbook.Worksheets[index]; if (changedSheet != null) { IRange range = changedSheet.Range[e.Cell.RowIndex, e.Cell.ColumnIndex]; SetAlignment(range, e.Style); } } } }
/// <summary> /// Set the CellType based on specified index /// </summary> void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.ColIndex == 4 && e.RowIndex == 6) { e.Style.CellType = "MultipleButton"; e.Style.Description = "Click"; } }
void CalcGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.ColIndex > 0) { int j = GetColorID(GridRangeInfo.Cell(e.RowIndex, e.ColIndex)); e.Style.BackColor = (j == -1) ? ColorTranslator.FromHtml("#003B51") : colorCollection[j]; } }
void CalcGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 0) { int j = GetColorID(GridRangeInfo.Cell(e.Cell.RowIndex, e.Cell.ColumnIndex)); e.Style.Background = (j == -1) ? e.Style.Background = new SolidColorBrush(Color.FromArgb(255, 00, 59, 81)) : colorCollection[j]; } }
private void Grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 0) { //To update data into grid cells. e.Style.CellValue = table.Rows[e.Cell.RowIndex - 1][e.Cell.ColumnIndex - 1]; } }
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { // Setting CellValue here would overwrite CellData - better is to if (!e.Style.HasCellValue) { e.Style.CellValue = String.Format("{0}:{1}", e.Cell.RowIndex, e.Cell.ColumnIndex); } }
/// <summary> /// Handles the QueryCellInfo event of the InternalGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs"/> instance containing the event data.</param> static void InternalGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Style.ColumnIndex == 6 && e.Style.RowIndex > 0) { e.Style.CellType = "CurrencyEdit"; e.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; } }
private void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.Style.CellType == GridCellTypeName.TextBox && this.gridControl1.CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex)) { //to adjust the text position in edit mode. e.Style.TextMargins.Top = System.Convert.ToInt32(this.gridControl1.RowHeights[e.RowIndex] / 3); } }
private void TableModel_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (e.RowIndex > this.pivotGridControl1.PivotColumns.Count + (this.pivotGridControl1.PivotCalculations.Count > 1 && this.pivotGridControl1.PivotEngine.ShowCalculationsAsColumns ? 1 : 0) && e.ColIndex > this.pivotGridControl1.PivotRows.Count + (this.pivotGridControl1.PivotEngine.ShowCalculationsAsColumns ? 0 : 1) && e.Style.CellValue != null) { e.Style.CellType = "HyperlinkCell"; e.Style.Tag = null; } }
//The cell style settings can be customized void TableModel_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { if (allowTooltip && e.RowIndex > 0 && e.ColIndex > 0 && e.RowIndex <= pivotGridControl1.PivotEngine.RowCount) { PivotCellInfo cellinfo = pivotGridControl1.PivotEngine[e.RowIndex - 1, e.ColIndex - 1]; string tooltip = "Value\t: " + (string.IsNullOrEmpty(e.Style.Text) ? "(No Value)" : e.Style.Text.ToString()); PivotCellInfo colParent = pivotGridControl1.PivotEngine[0, e.ColIndex - 1].ParentCell; PivotCellInfo rowParent = pivotGridControl1.PivotEngine[e.RowIndex - 1, 0].ParentCell; if (colParent != null) { tooltip += "\nColumn\t: " + colParent.Value; } else { if (pivotGridControl1.PivotEngine[0, e.ColIndex - 1].Value != null && pivotGridControl1.PivotEngine[0, e.ColIndex - 1].Value.ToString() != null) { tooltip += "\nColumn\t: " + pivotGridControl1.PivotEngine[0, e.ColIndex - 1].Value; } else if (pivotGridControl1.PivotEngine[0, e.ColIndex - 1].Value == null && e.ColIndex > 1) { tooltip += "\nColumn\t: " + pivotGridControl1.PivotEngine[0, e.ColIndex - 2].Value; } } object subRow = pivotGridControl1.PivotEngine[e.RowIndex - 1, 1].Value; if (rowParent != null) { tooltip += "\nRow\t: " + rowParent.Value + " - " + subRow; } else { tooltip += "\nRow\t: " + (pivotGridControl1.PivotEngine[e.RowIndex - 1, 0].Value != null ? pivotGridControl1.PivotEngine[e.RowIndex - 1, 0].Value : pivotGridControl1.PivotEngine[e.RowIndex - 1, 0].UniqueText) + " - " + subRow; } if (e.Style.Tag != null) { string valueHeader = cellinfo.CellType.ToString().Contains("ColumnHeaderCell") ? "Column : " : (cellinfo.CellType.ToString().Contains("RowHeaderCell") ? "Row : " : "Value : "); tooltip = valueHeader + e.Style.Text; } if ((!chkColHeader.Checked && (cellinfo.CellType == (PivotCellType.ColumnHeaderCell | PivotCellType.ExpanderCell) || cellinfo.CellType == (PivotCellType.ColumnHeaderCell | PivotCellType.HeaderCell) || cellinfo.CellType == (PivotCellType.ColumnHeaderCell | PivotCellType.CalculationHeaderCell))) || (!chkRowHeader.Checked && (cellinfo.CellType == (PivotCellType.RowHeaderCell | PivotCellType.ExpanderCell) || cellinfo.CellType == (PivotCellType.RowHeaderCell | PivotCellType.HeaderCell))) || (!chkSummary.Checked && (cellinfo.CellType == (PivotCellType.GrandTotalCell | PivotCellType.ValueCell) || cellinfo.CellType == (PivotCellType.TotalCell | PivotCellType.ValueCell))) || (!chkValue.Checked && cellinfo.CellType == PivotCellType.ValueCell) || (!chkSumHeader.Checked && (cellinfo.CellType == (PivotCellType.GrandTotalCell | PivotCellType.RowHeaderCell) || cellinfo.CellType == (PivotCellType.GrandTotalCell | PivotCellType.ColumnHeaderCell) || cellinfo.CellType == (PivotCellType.GrandTotalCell | PivotCellType.ColumnHeaderCell | PivotCellType.HeaderCell) || cellinfo.CellType == (PivotCellType.GrandTotalCell | PivotCellType.RowHeaderCell | PivotCellType.HeaderCell) || cellinfo.CellType == (PivotCellType.TotalCell | PivotCellType.RowHeaderCell) || cellinfo.CellType == (PivotCellType.TotalCell | PivotCellType.ColumnHeaderCell)))) { tooltip = string.Empty; } e.Style.CellTipText = tooltip; } }
void SampleGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { GridBorder gb = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(158, 182, 206)); if (e.Style.CellType == GridCellTypeName.Header) { e.Style.Borders.Bottom = e.Style.Borders.Right = gb; } }
private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { GridModel model = this.gridDataBoundGrid1.Model; int ColIndex = this.gridDataBoundGrid1.Model.NameToColIndex("CheckBox"); if (e.RowIndex > 0 && e.ColIndex == ColIndex && ColIndex != -1) { // Set up a CheckBox control. e.Style.CellType = "CheckBox"; e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; e.Style.VerticalAlignment = GridVerticalAlignment.Middle; e.Style.CellValueType = typeof(bool); // Determine the Checked and Unchecked values of CheckBox. e.Style.CheckBoxOptions.CheckedValue = "True"; e.Style.CheckBoxOptions.UncheckedValue = "False"; e.Style.Enabled = true; int keyColIndex1 = model.NameToColIndex("Type"); string key1 = model[e.RowIndex, keyColIndex1].Text; int keyColIndex2 = model.NameToColIndex("Name"); string key2 = model[e.RowIndex, keyColIndex2].Text; if (key1 != null && key2 != null) { object value = false; if (!CheckBoxValues.ContainsKey(key1 + ":" + key2)) if (SelectedTargetRows.Contains(e.RowIndex)) CheckBoxValues.Add(key1 + ":" + key2, true); else CheckBoxValues.Add(key1 + ":" + key2, false); else if (SelectedTargetRows.Contains(e.RowIndex)) { CheckBoxValues[key1 + ":" + key2] = true; value = CheckBoxValues[key1 + ":" + key2]; } else { CheckBoxValues[key1 + ":" + key2] = false; value = CheckBoxValues[key1 + ":" + key2]; } // Display the value in checkbox. if (value != null) e.Style.CellValue = value; } } }