To create the simplest C1OLAP application, start by creating a new WPF or Silverlight application and dragging a C1OlapPage control onto the page. Allow the C1OlapPage control to fill the entire page by removing all margin and alignment settings.
Now, let us set a data source for the application.
For this sample, we load Northwind product data from an XML data schema file. We use ComponentOne Data , which provides us the familiar DataSet and DataTable objects to read the data in. We also use ComponentOne Zip to unpackage the zipped XML file on the client.
Visual Basic |
Copy Code
|
---|---|
' load data from embedded zip resource Dim ds = New DataSet() Dim asm = Assembly.GetExecutingAssembly() Using s = asm.GetManifestResourceStream("OlapQuickStart.nwind.zip") Dim zip = New C1ZipFile(s) Using zr = zip.Entries(0).OpenReader() ' load data ds.ReadXml(zr) End Using End Using |
C# |
Copy Code
|
---|---|
// load data from embedded zip resource var ds = new DataSet(); var asm = Assembly.GetExecutingAssembly(); using (var s = asm.GetManifestResourceStream("OlapQuickStart.nwind.zip")) { var zip = new C1ZipFile(s); using (var zr = zip.Entries[0].OpenReader()) { // load data ds.ReadXml(zr); } } |
Then we simply set the DataSource property on the C1OlapPage control. We could use any data binding method with this control.
Visual Basic |
Copy Code
|
---|---|
' bind olap page to data
_c1OlapPage.DataSource = ds.Tables(0).DefaultView
|
C# |
Copy Code
|
---|---|
// bind olap page to data
_c1OlapPage.DataSource = ds.Tables[0].DefaultView;
|
The application is now ready. The following sections describe the functionality provided by default, without writing any code aside from configuring our data source.