diff --git a/blazor/common/migration/wpf-blazor-migration.md b/blazor/common/migration/wpf-blazor-migration.md index b655d059e..eb7073aac 100644 --- a/blazor/common/migration/wpf-blazor-migration.md +++ b/blazor/common/migration/wpf-blazor-migration.md @@ -1,26 +1,19 @@ --- layout: post -title: Migrating from WPF to Blazor | Syncfusion -description: Guide to migrating Syncfusion WPF apps to Blazor, covering key components and detailed DataGrid migration. +title: Migrating Syncfusion WPF Controls to Blazor +description: Guide to migrate Syncfusion WPF controls to Syncfusion Blazor components on .NET 8+, with setup, config, and examples. platform: Blazor component: Common documentation: ug --- -# Migrating from WPF to Blazor +# Migrating Syncfusion® WPF Controls to Blazor -## Overview +Migrating enterprise applications from **[WPF (Windows Presentation Foundation)](https://learn.microsoft.com/en-us/dotnet/desktop/wpf/overview/)** to **[Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/)** involves a significant architectural transition, moving from a rich, XAML-based desktop client framework to a component-driven, cross-platform web framework running on .NET. This guide provides a structured, step-by-step migration path for **[Syncfusion WPF Controls](https://www.syncfusion.com/wpf-controls)** to their **[Syncfusion Blazor equivalents](https://www.syncfusion.com/blazor-components)** using **[Visual Studio](https://visualstudio.microsoft.com/vs/)** or **[Visual Studio Code](https://code.visualstudio.com/)**. -Migrating enterprise applications from **[WPF (Windows Presentation Foundation)](https://learn.microsoft.com/en-us/dotnet/desktop/wpf/overview/)** to **[Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/)** involves a significant architectural transition, moving from a rich, XAML-based desktop client framework to a component-driven, cross-platform web framework running on .NET. This guide provides a structured, step-by-step migration path for **[Syncfusion WPF components](https://www.syncfusion.com/wpf-controls)** to their **[Syncfusion Blazor equivalents](https://www.syncfusion.com/blazor-components)**, developed using **[Visual Studio](https://visualstudio.microsoft.com/vs/)** or **[Visual Studio Code](https://code.visualstudio.com/)**. +It focuses on key architectural differences and demonstrates the essential setup and rendering patterns required to successfully migrate major Syncfusion UI components from WPF to Blazor. -This document covers: -* Architectural differences between WPF and Blazor -* Initial rendering setup for major Syncfusion components -* Detailed DataGrid migration with feature parity mapping - -### Why migrate from WPF to Blazor? - -> **Blazor Web App with Interactive Server render mode** is often the closest fit for WPF-style responsiveness and centrally managed state. +## Why migrate from WPF to Blazor? | Dimension | WPF | Blazor Web App (Interactive Server) | |---|---|---| @@ -50,12 +43,14 @@ Run the following commands to verify that the installed .NET SDK version is 8.0 {% tabs %} {% highlight bash tabtitle=".NET CLI" %} -dotnet --version # Print installed .NET SDK version (should be 8.0.x or later) +dotnet --version # Print installed .NET SDK version (should be 8.0 or later) dotnet new list blazor # List available/installed Blazor project templates {% endhighlight %} {% endtabs %} +N> This guide is tested with .NET 8.0 and later versions. Ensure that your installed SDK version is 8.0 or higher. + ## Project structure comparison WPF and Blazor use different application models. The table below shows the closest functional equivalents, not a strict one-to-one match. @@ -74,9 +69,7 @@ WPF and Blazor use different application models. The table below shows the close | `ICommand` and `RelayCommand` | Event handlers, `EventCallback`, or injected services | Handles user actions and command logic | | `INotifyPropertyChanged` | Component state and re-rendering | Updates the UI when state changes | -## Getting started: project creation - -### Creating a Blazor Web App with Interactive Server in VS Code +## Creating a Blazor Web App with Interactive Server in Visual Studio Code {% tabs %} {% highlight bash tabtitle=".NET CLI" %} @@ -93,133 +86,97 @@ N> The `--interactivity Server` flag configures SignalR-based interactivity and ## Migrating key Syncfusion components from WPF to Blazor -This section provides **step-by-step migration guidance** for six Syncfusion components, with side-by-side WPF and Blazor code examples: - -1. **[DataGrid](https://www.syncfusion.com/blazor-components/blazor-datagrid)** - Tabular data display with sorting, filtering, editing, and grouping -2. **[TreeGrid](https://www.syncfusion.com/blazor-components/blazor-tree-grid)** - Hierarchical data display in a grid format -3. **[Charts](https://www.syncfusion.com/blazor-components/blazor-charts)** - Data visualization with various chart types -4. **[Scheduler](https://www.syncfusion.com/blazor-components/blazor-scheduler)** - Calendar and appointment scheduling -5. **[Diagram](https://www.syncfusion.com/blazor-components/blazor-diagram)** - Visual diagramming and flowchart creation -6. **[RichTextEditor](https://www.syncfusion.com/blazor-components/blazor-rich-text-editor)** - Rich text editing with formatting capabilities - -Each component section includes package installation, theme setup, service registration, and basic rendering code for both platforms. - -### 1. DataGrid +The following shared setup applies to all six Syncfusion components and covers the common configuration required before moving on to the [component-specific migration steps](./wpf-blazor-migration#1-datagrid). -For detailed explanation, refer to the [WPF DataGrid getting started guide](https://help.syncfusion.com/wpf/datagrid/getting-started) and [Blazor DataGrid getting started guide](https://blazor.syncfusion.com/documentation/datagrid/getting-started-with-server-app). +### Common NuGet packages -#### Migration overview +Use the following NuGet packages for each component. -| Aspect | WPF (SfDataGrid) | Blazor (SfGrid) | +| Component | WPF package (NuGet) | Blazor package (NuGet) | |---|---|---| -| Package (NuGet) | `Syncfusion.SfGrid.WPF` | `Syncfusion.Blazor.Grid` | -| Namespace | `Syncfusion.UI.Xaml.Grid` | `Syncfusion.Blazor.Grids` | -| Component declaration | `` | `` | -| Data binding | `ItemsSource` with `DataContext` or a view model | `DataSource` with component state | -| Collection type | `ObservableCollection` is commonly used | `List` or `IEnumerable` is commonly used | -| Columns | `GridTextColumn`, `GridNumericColumn`, `GridTemplateColumn` | `GridColumn` with `Field`, `Format`, and `EditType` | -| Templates | XAML `DataTemplate` | Razor `