You can easily create a C1Cube control at design time, in XAML, and in code. Note that if you create a C1Cube control as in the following steps, it will appear as an empty container. You will need to add items to the control for it to appear as a cube at run time. For an example, see Adding Items to a Cube.
At Design Time in Blend
To create a C1Cube control in Visual Studio, complete the following steps:
1. Click once on the design area of the window to select it.
2. Double-click the C1Cube icon in the Toolbox to add the control to the panel. The C1Cube control will now exist in your application.
3. If you choose, can customize the control by selecting it and setting properties in the Properties window.
In XAML
To create a C1Cube control using XAML markup, complete the following steps:
1. In the Visual Studio Solution Explorer, right-click the References folder in the project files list. In the context menuchoose Add Reference, select the C1.WPF.dll and C1.WPF.Legacy.dll assemblies, and click OK.
1. Add a XAML namespace to your project by adding xmlns:c1ext="http://schemas.componentone.com/wpf/C1Legacy" to the initial <Window> tag. It will appear similar to the following:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1ext="http://schemas.componentone.com/wpf/C1Legacy" x:Class="C1CubeCS101909.Window1" Title="Window1" Height="358" Width="498">
2. Add a <c1ext:C1Cube> tag to your project within the <Grid> tag to create a C1Cube control. The markup will appear similar to the following:
<Grid>
<c1ext:C1Cube x:Name="c1cube1" Height="300" Width="300"/>
</c1ext:C1Cube>
</Grid>
This markup will create an empty C1Cube control named "c1cube1" and set the control's size.
In Code
To create a C1Cube control in code, complete the following steps:
1. In the Visual Studio Solution Explorer, right-click the References folder in the project files list. In the context menuchoose Add Reference, select the C1.WPF.dll and C1.WPF.Legacy.dll assemblies, and click OK.
2. In XAML view, give the initial grid in the window a name, by updating the tag so it appears similar to the following:
<Grid x:Name="LayoutRoot">
3. Right-click within the Window1.xaml window and select View Code to switch to Code view
4. Add the following import statements to the top of the page:
Imports C1.WPF
Imports C1.WPF.Legacy
•C#
using C1.WPF;
using C1.WPF.Legacy;
5. Add code to the page's constructor to create the C1Cube control. It will look similar to the following:
Public Sub New()
InitializeComponent()
Dim c1cube1 as New C1Cube
c1cube1.Height = 300
c1cube1.Width = 300
LayoutRoot.Children.Add(c1cube1)
End Sub
•C#
public Window1()
{
InitializeComponent();
C1Cube c1cube1 = new C1Cube();
c1cube1.Height = 300;
c1cube1.Width = 300;
LayoutRoot.Children.Add(c1cube1);
}
This code will create an empty C1Cube control named "c1cube1", set the control's size, and add the control to the page.
What You've Accomplished
You've created a C1Cube control. Note that when you create a C1Cube control as in the above steps, it will appear as an empty container. You will need to add items to the control for it to appear as a cube at run time. For an example, see Adding Items to a Cube.