Category / Section
How to change the cell style in Silverlight OLAP Grid ?
1 min read
You can change the cell style of a particular cell in OLAP Grid by using the QueryCellInfo event as illustrated in the following code example.
C#
public partial class MainPage : UserControl
{
private IOlapDataProvider dataProvider;
public object OlapDataManager;
public MainPage()
{
InitializeComponent();
InitializeConnection();
this.grid.InternalGrid.QueryCellInfo += new Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventHandler(InternalGrid_QueryCellInfo);
}
private void InitializeConnection()
{
Binding customBinding = new CustomBinding(new BinaryMessageEncodingBindingElement(), new HttpTransportBindingElement { MaxReceivedMessageSize = 2147483647 });
EndpointAddress address = new EndpointAddress("http://bi.syncfusion.com/OlapWcfProject/Services/OlapManager.svc/binary");
ChannelFactory<IOlapDataProvider> clientChannel = new ChannelFactory<IOlapDataProvider>(customBinding, address);
dataProvider = clientChannel.CreateChannel();
OlapDataManager olapDataManager = new OlapDataManager();
olapDataManager.DataProvider = dataProvider;
olapDataManager.SetCurrentReport(CreateOlapReport());
this.OlapDataManager = olapDataManager;
}
void InternalGrid_QueryCellInfo(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e)
{
e.Style.CellType = "Value";
e.Style.CellValue = "$234509000.00";
SolidColorBrush background = new SolidColorBrush(Colors.Cyan);
e.Style.Background = background;
e.Handled = true;
}
VB
Partial Public Class MainPage
Inherits UserControl
Private dataProvider As IOlapDataProvider
Public OlapDataManager As Object
Public Sub New()
InitializeComponent()
InitializeConnection()
Me.grid.InternalGrid.QueryCellInfo += New Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventHandler(InternalGrid_QueryCellInfo)
End Sub
Private Sub InitializeConnection()
Binding customBinding = New CustomBinding(New BinaryMessageEncodingBindingElement(), New HttpTransportBindingElement
{
MaxReceivedMessageSize = 2147483647
})
Dim address As EndpointAddress = New EndpointAddress("http://bi.syncfusion.com/OlapWcfProject/Services/OlapManager.svc/binary")
Dim clientChannel As ChannelFactory<IOlapDataProvider> = New ChannelFactory<IOlapDataProvider>(customBinding,address)
dataProvider = clientChannel.CreateChannel()
Dim olapDataManager As OlapDataManager = New OlapDataManager()
olapDataManager.DataProvider = dataProvider
olapDataManager.SetCurrentReport(CreateOlapReport())
Me.OlapDataManager = olapDataManager
End Sub
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"
Dim background As SolidColorBrush = New SolidColorBrush(Colors.Cyan)
e.Style.Background = background
e.Handled = True
End Sub
Didn't find an answer?
Contact Support