blazor-405739-get-started-vs-code-extend-project.md
The DevExpress Template Kit is the fastest way to create new Blazor apps with DevExpress UI. However, the Template Kit cannot integrate DevExpress components into an existing Blazor project. This help topic explains how to install packages, register services and static resources, and add a DevExpress Blazor component to your existing app.
Note
This tutorial uses the default Visual Studio Code Blazor Web App template as the starting project. If you already have a Blazor project, skip to the next section.
cd command in the terminal to navigate to your project’s directory.Register internal DevExpress Blazor services in the Program.cs file.
Register the DevExpress.Blazor namespace in the Components_Imports.razor file:
Apply the application-wide DevExpress Blazor theme and add client scripts in the Components\App.razor file.
To get acquainted with the project structure, add a simple DevExpress Blazor component (Calendar) to the application’s home page and see it in action:
Open the Components\Pages\Home.razor file.
The DevExpress Calendar for Blazor does not support static render mode. Enable interactivity:
Add the DxCalendar component to the page. Bind the component to the SelectedDate variable to test interactivity.
Press F5 to run your application.
Full code:
@page "/"
@rendermode InteractiveServer
<PageTitle>Home</PageTitle>
<h1>Hello, world!</h1>
<DxCalendar @bind-SelectedDate="@SelectedDate" />
<p><b>Selected date:</b> @SelectedDate.ToLongDateString()</p>
@code {
DateTime SelectedDate { get; set; } = DateTime.Now;
}