First Steps with Telerik UI for WinForms
This article explains how to get the Telerik UI for WinForms controls in your project and start using them quickly. The process consists of the following steps:
- Start Your Free Trial
- Download the Controls
- Create a new WinForms Telerik Project
- Add Telerik Control to a Form
- Next Steps
Start Your Free Trial
- If you already have an active license for Telerik UI for WinForms, skip this step and continue with the next step.
-
If you don't have an active license, follow the steps below to activate your free trial:
Download the WinForms Installer and start the installation.
Make sure that Telerik UI for .NET WinForms is selected and continue with the setup.
Log in with your Telerik account and complete the installation.
After the successful installation of Telerik UI for Winforms, the Installer activates your 30 day free trial. The installer also downloads your license key file, so you can skip the next step and continue with Create a new WinForms Telerik Project.
Download Your License Key File
To download and install your Telerik license key file:
- Go to the License Keys page in your Telerik account.
- Click the Download License Key button.
- Save the
telerik-license.txt
file to%AppData%\Telerik\telerik-license.txt
.
This will make the license key available to all Telerik .NET apps that you develop on your local machine.
Download the Controls
The easiest way to get the controls to your development machine is to use the Progress Control Panel or to download the automated MSI installer from your telerik.com account.
Figure 1: Download automated (.msi) installer
If you are not a customer, you can download a free, fully functional trial and the same options will apply to you as well.
The following article provides step-by-step instructions how to install Telerik UI for WinForms on your computer: Installing UI for WinForms
Create a new WinForms Telerik Project
If you do not have a project, run the Create Project Wizard
Figure 2: Go to Telerik > UI for WinForms > Create new Telerik project
This will also automatically add 3 of the most common Telerik dll references - Telerik.WinControls, Telerik.WinControls.UI and Telerik.Common.
Add Telerik Control to a Form
The final step is to add a Telerik control to your application. As an example we will use a RadGridView control with auto generated coumns.
We will add the RadGridView control from the Toolbox. To do that simply search for RadGridView in the Toolbox and drag it to the surface of the form designer. If you do not see the Toolbox, go to View > Toolbox. Using this method will also automatically add any missing dlls to your project.
Figure 3: Add RadGridView from the Toolbox
Binding to Lists of Objects
The example below defines a MyObject class containing one integer and two string properties. The next set of code snippets "Creating an List of Objects" creates an array of MyObjects, initializes the array and assigns the array to the DataSource. The MyObject class would typically be placed in its own separate class file and the List creation, initialization and assignment code might be placed at the bottom of the form's Load event handler.
public class MyObject
{
private int id;
private string items;
private string serial;
public int ID
{
get { return id; }
set { id = value; }
}
public string Items
{
get { return items; }
set { items = value; }
}
public string Serial
{
get { return serial; }
set { serial = value; }
}
public MyObject()
{
}
}
Public Class MyObject
Private id As Integer
Private items As String
Private serial As String
Public Property ID As Integer
Get
Return id
End Get
Set(ByVal value As Integer)
id = value
End Set
End Property
Public Property Items As String
Get
Return items
End Get
Set(ByVal value As String)
items = value
End Set
End Property
Public Property Serial As String
Get
Return serial
End Get
Set(ByVal value As String)
serial = value
End Set
End Property
Public Sub New()
End Sub
End Class
List<MyObject> myList = new List<MyObject>();
myList.Add(new MyObject() { ID = 1, Items = "Monitor", Serial = Guid.NewGuid().ToString() });
myList.Add(new MyObject() { ID = 2, Items = "Keyboard", Serial = Guid.NewGuid().ToString() });
myList.Add(new MyObject() { ID = 3, Items = "Mouse", Serial = Guid.NewGuid().ToString() });
myList.Add(new MyObject() { ID = 4, Items = "System Unit", Serial = Guid.NewGuid().ToString() });
radGridView1.DataSource = myList;
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
Dim myList As List(Of MyObject) = New List(Of MyObject)()
myList.Add(New MyObject() With {
.ID = 1,
.Items = "Monitor",
.Serial = Guid.NewGuid().ToString()
})
myList.Add(New MyObject() With {
.ID = 2,
.Items = "Keyboard",
.Serial = Guid.NewGuid().ToString()
})
myList.Add(New MyObject() With {
.ID = 3,
.Items = "Mouse",
.Serial = Guid.NewGuid().ToString()
})
myList.Add(New MyObject() With {
.ID = 4,
.Items = "System Unit",
.Serial = Guid.NewGuid().ToString()
})
radGridView1.DataSource = myList
radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill
For this example we also need to ensure we have reference for System; System.Collections.Generic and Telerik.WinControls.UI dlls in the RadForm1.Designer.cs.
Figure 4: Final result should look like this:
Next Steps
Now that you have the Telerik UI for WinForms controls running in your project, you may want to explore their features, customize their behavior or change their appearance. Below you can find guidance on getting started with such tasks: