Add Syncfusion WPF Controls

18 Oct 20226 minutes to read

The Syncfusion WPF controls can be added in a Visual Studio projects by using either of the following ways:

  • Using Designer
  • Using Code-Behind
  • Using Project Template

Using Designer

Syncfusion UI for WPF are added automatically to the Visual Studio Toolbox during installation. The following steps help you to add the required Essential WPF control using drag and drop from the Toolbox. For example: SfTextBoxExt

  1. Create a WPF project in Visual Studio.

  2. Find SfTextBoxExt by typing the name of the “SfTextBoxExt” in the search box.

Drag and drop from toolbox

  1. Drag SfTextBoxExt and drop it in the designer.

WPF TextBoxExt control

Using XAML

The following steps help you to add a required Essential WPF Control using XAML Code, for example: SfTextBoxExt.

  1. Create a WPF project in Visual Studio and refer the following assemblies:

    • Syncfusion.SfInput.WPF.dll
    • Syncfusion.SfShared.WPF.dll
  2. Include an XML namespace for the above assemblies to the Main window.

    <Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:syncfusion="http://schemas.syncfusion.com/wpf" />
  3. Now, add the SfTextBoxExt control with a required optimal name using the included namespace.

    <syncfusion:SfTextBoxExt HorizontalAlignment="Center" Name="textBoxExt1" Margin="10" Height ="20" Width="120" Text="SfTextBoxExt" VerticalAlignment="Center"/>

Using Code-Behind

Syncfusion UI for WPF can be added at runtime using C# / VB. The following steps help you to add required Essential WPF control using code. For example: SfTextBoxExt.

  1. Create a WPF project in Visual Studio and refer to the following assemblies:

    • Syncfusion.SfInput.WPF.dll
    • Syncfusion.SfShared.WPF.dll
  2. Create an instance of SfTextBoxExt, using its namespace.

    Syncfusion.Windows.Controls.Input.SfTextBoxExt textBoxExt1 = new Syncfusion.Windows.Controls.Input.SfTextBoxExt();
    Dim textBoxExt1 As New Syncfusion.Windows.Controls.Input.SfTextBoxExt()
  3. Set the Size and Alignment of the control with required value.

    textBoxExt1.Height = 20;
    textBoxExt1.Width = 120;
    textBoxExt1.Margin = new Thickness(10, 10, 10, 10);
    textBoxExt1.VerticalAlignment = VerticalAlignment.Center;
    textBoxExt1.HorizontalAlignment = HorizontalAlignment.Center;
    textBoxExt1.Height = 20
    textBoxExt1.Width = 120
    textBoxExt1.Margin = New Thickness(10, 10, 10, 10)
    textBoxExt1.VerticalAlignment = VerticalAlignment.Center
    textBoxExt1.HorizontalAlignment = HorizontalAlignment.Center
  4. Add the created instance to the parent window (or the needed layout panels).

    // Here this denotes parent Window
    this.Content = textBoxExt1;
    ' Here this denotes parent Window
    Me.Content = textBoxExt1

WPF TextBoxExt control

Using Project Template

Syncfusion provides the Visual Studio Project Templates for the Syncfusion WPF platform to create Syncfusion WPF Application.

IMPORTANT

The Syncfusion WPF templates are available from v16.1.0.24.

Create Syncfusion WPF project

The following steps direct you to create the Syncfusion WPF project using the Visual Studio Project Template.

  1. To create a Syncfusion WPF project, choose New Project-> Syncfusion->Windows->Syncfusion WPF Application from Visual Studio.

Create WPF application

  1. Name the Project, choose the destination location when required and set the framework of the project, then click OK.

NOTE

Minimum target Framework is 4.0 for Syncfusion WPF project templates.

  1. Choose the options to configure the Syncfusion WPF Application by using the following Project Configuration Wizard.

WPF Project configuration wizard

Project configurations

Language: Select the language, either C# or VB.

Different language shows in WPF project

Choose Theme: Choose the required theme.

Visual studio theme of WPF

Assemblies From: Choose the assembly location from where it will be added to the project.

Choosing assembly location for WPF project

Select Control: Choose the control based on your need.

Select the WPF Control

  1. Once the Project Configuration Wizard is done, the Syncfusion WPF project is created with required references and XAML.

Added assemblies for WPF control

Shows project folder for added control

  1. Then, Syncfusion licensing registration required message box will be shown as follows, if you have installed the trial setup or NuGet packages since Syncfusion introduced the licensing system with the 2018 Volume 2 (v16.2.0.41) Essential Studio release. Please navigate to the help topic, which is shown in the licensing message box to generate and register the Syncfusion license key for your project. Refer to this blog post for understanding the licensing changes introduced in Essential Studio.

Shows syncfusion license registration message