Knowledgebase: RadarCube WPF
RadarCube for WPF. Getting started
Posted by Vladimir Lyutetsky on 21 July 2010 12:39 PM

Preparing data. Desktop-version

Both DataSet and DataContext (LINQ for SQL) objects can serve as data sources for your cube. Like all other versions, the RadarCube for WPF is specifically designed for working with data sources of a few tables – though that doesn’t mean you cannot use the DataSet or DataContext with a single table in it.
The data source, like the TOLAPCube control, should be placed to the Window.Resources section of the XAML file. An instance of the data source should be bound to the DataContext property of the cube, like this:

 

<Window x:Class="RadarSoft.RadarCube.Demo.WPF.Desktop.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:olapcube="clr-namespace:RadarSoft.RadarCube.WPF.Desktop;assembly=RadarSoft.RadarCube.WPF.Desktop">
    <Window.Resources>
        <local:Northwind x:Key="dsNorthwind"  />
        <olapcube:TOLAPCube x:Key="cube1" DataContext="{Binding Source={StaticResource dsNorthwind}}"  />
    </Window.Resources>

 

With that done, the next step you have to take is designing the cube structure. If you’re in the Design Time, press the “Edit cube…” hyperlink in the Cube Properties editor.

Cube Properties editor

For more details about working with the editor and the Cube Creation Wizard, see the «Designing the Cube with the Cube Creation Wizard» and the «Using Cube Editor to Construct a Cube» articles.
If you open the cube in Runtime, you have to have the data source already filled. You can fill it either right before you set the TOLAPCube.Active property to TRUE or in the TOLAPCube.BeforeReadDatabase event handler.
Naturally, creating a cube in DesignTime is not your only option. You can call the Cube editor in Runtime as well or create a cube programmatically, as described in this article: «RadarCube ASP.NET Direct: Creating the Cube in run time».

Preparing data. MSAS-version

TMDCube control, responsible for the connection to the MSAS-cube, should be placed to the Window.Resources section of the XAML file:

 

<Window x:Class="RadarSoft.RadarCube.Demo.WPF.MSAS.MainWindow" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mdcube="clr-namespace:RadarSoft.RadarCube.WPF.MSAS;assembly=RadarSoft.RadarCube.WPF.MSAS">
    <Window.Resources>
        <mdcube:TMDCube x:Key="cube1"  /> 
    </Window.Resources>

 

All that is left to be done here is defining the cube connection parameters. To do it in DesignTime, call the TMDCube.ConnectionData property editor. To do it programmatically, assign the appropriate values to the TMDCube.ConnectionString and the TMDCube.CubeName properties.

Cube Properties editor

You can open the cube by setting the TMDCube.Active property to True. Alternatively, you can do that programmatically or in DesignTime.

Connecting the cube to the TOLAPGrid and TOLAPChart visual controls

All you need to do is bind an instance of the cube to the TOLAPGrid’s or TOLAPChart’s Cube property. You can also do that programmatically or in XAML:

 

 <TabControl Name="tabControl1"  >
      <TabItem Header="OLAP  Grid" Name="tabItem1">
            <olapgrid:TOLAPGrid x:Name="grid" Cube="{Binding Source={StaticResource cube1}}"  />
      </TabItem> 
      <TabItem Header="OLAP  Chart" Name="tabItem2"> 
             <olapchart:TOLAPChart x:Name="chart" Cube="{Binding Source={StaticResource cube1}}"  />
       </TabItem> 
  </TabControl> 
(169 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako Resolve