You can easily create a C1DataGrid control at design time in Expression Blend, in XAML, and in code. Note that if you create a C1DataGrid control as in the following steps, it will appear empty. You will need to bind the grid or populate it with data.
At Design Time in Blend
To create a C1DataGrid control in Blend, complete the following steps:
The dialog box will close and the references will be added to your project and the controls will be available in the Asset Library.
The C1DataGrid icon will appear in the Toolbox under the Assets button.
In XAML
To create a C1DataGrid control using XAML markup, complete the following steps:
XAML |
Copy Code
|
---|---|
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" x:Class="C1DataGrid.MainWindow" Width="640" Height="480"><UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml x:Class="C1DataGrid.MainPage" Width="640" Height="480"> |
XAML |
Copy Code
|
---|---|
<Grid x:Name="LayoutRoot" Background="White"> <c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" /> </Grid> |
This markup will create an empty C1DataGrid control named "c1datagrid1" and set the control's size.
In Code
To create a C1DataGrid control in code, complete the following steps:
Visual Basic |
Copy Code
|
---|---|
Imports C1.WPF|variable=WPF.DataGrid |
C# |
Copy Code
|
---|---|
using C1.WPF|variable=WPF.DataGrid;
|
Visual Basic |
Copy Code
|
---|---|
Public Sub New() InitializeComponent() Dim c1datagrid1 As New C1DataGrid c1datagrid1.Height = 180 c1datagrid1.Width = 250 LayoutRoot.Children.Add(c1datagrid1) End Sub |
C# |
Copy Code
|
---|---|
public MainPage() { InitializeComponent(); C1DataGrid c1datagrid1 = new C1DataGrid(); c1datagrid1.Height = 180; c1datagrid1.Width = 250; LayoutRoot.Children.Add(c1datagrid1); } |
This code will create an empty C1DataGrid control named "c1datagrid1", set the control's size, and add the control to the page.
What You've Accomplished
Run your application and observe that you've created a C1DataGrid control.
Note that when you create a C1DataGrid control as in the above steps, it will appear empty. You can add items to the control that can be interacted with at run time.