Category / Section
How to change the cell style in OLAP Grid?
1 min read
You can change the style of a particular cell in OLAP Grid inside the QueryCellInfo event as illustrated in the following code example.
C#
public MainWindow() { try { InitializeComponent(); this.olapgrid.OlapDataManager = new OlapDataManager("Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;"); this.olapgrid.OlapDataManager.SetCurrentReport(SampleReport()); this.olapgrid.InternalGrid.QueryCellInfo += new Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventHandler(InternalGrid_QueryCellInfo); } catch (Exception ex) { ShowExceptionMessage(ex); } } void InternalGrid_QueryCellInfo(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e) { e.Style.CellType = "Value"; e.Style.CellValue = "$234509000.00"; e.Style.Background = Brushes.Cyan; e.Handled = true; }
VB
Private Function MainWindow() As Public Try InitializeComponent() Me.olapgrid.OlapDataManager = New OlapDataManager("Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;") Me.olapgrid.OlapDataManager.SetCurrentReport(SampleReport()) Me.olapgrid.InternalGrid.QueryCellInfo += New Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventHandler(InternalGrid_QueryCellInfo) Catch ex As Exception ShowExceptionMessage(ex) End Try End Function Private Sub InternalGrid_QueryCellInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs) e.Style.CellType = "Value" e.Style.CellValue = "$234509000.00" e.Style.Background = Brushes.Cyan e.Handled = True End Sub