| MAUI-Project-Structure | MAUI-Features | |
XAML in MAUI vs. WPF |
Extensible Application Markup Language (XAML) is the declarative heart of both Windows Presentation Foundation (WPF) and .NET Multi-platform App UI (.NET MAUI), yet they represent two distinct evolutions of the same technology. At a high level, WPF is a mature, Windows-only framework optimized for high-performance desktop graphics using DirectX. In contrast, .NET MAUI is a modern, cross-platform evolution of Xamarin.Forms designed to run a single codebase across Windows, macOS, iOS, and Android. While they share the same XML-based syntax, their vocabularies and underlying rendering engines differ significantly.
At a high level, WPF is a mature, Windows-only framework optimized for high-performance desktop graphics using DirectX. In contrast, .NET MAUI is a modern, cross-platform evolution of Xamarin.Forms designed to run a single codebase across Windows, macOS, iOS, and Android. While they share the same XML-based syntax, their vocabularies and underlying rendering engines differ significantly.
The most immediate difference you will encounter is in the names of the UI elements. WPF uses names rooted in classic Windows desktop terminology, while MAUI uses more abstract, platform-agnostic names.
| Feature | WPF Control | .NET MAUI Control |
|---|---|---|
| Root Element | Window | ContentPage (nested in a Shell or Window) |
| Text Display | TextBlock or Label | Label |
| Text Input | TextBox (single/multi-line) | Entry (single) or Editor (multi-line) |
| Layout Container | StackPanel | StackLayout (or specialized VerticalStackLayout / HorizontalStackLayout) |
| Scrolling | ScrollViewer | ScrollView |
| Buttons | Button (uses Click event) | Button (uses Clicked event) |
The way elements are measured and positioned differs to accommodate mobile screens versus resizable desktop windows:
The "dialect" of XAML is defined by the XML namespaces at the top of your file:
Project Files A WPF app is usually a single-platform project. A .NET MAUI app uses a single project structure where a Platforms folder contains specific code for iOS, Android, and Windows, while the XAML remains shared across all of them.
WPF (DirectX) WPF renders directly using DirectX. It excels at complex 2D/3D graphics, vector animations, and pixel-perfect layouts on Windows.
MAUI (Native Handlers) MAUI uses an abstraction layer called Handlers. When you define a Button in MAUI XAML, the framework maps it to a UIButton on iOS, a Widget.Button on Android, and a WinUI Button on Windows. This ensures the app feels native on every device but can make pixel-perfect cross-platform consistency harder to achieve.
WPF Features a robust Visual Designer in Visual Studio that allows for drag-and-drop UI creation and a "What You See Is What You Get" (WYSIWYG) experience.
MAUI Does not have a drag-and-drop designer. Instead, it relies on XAML Hot Reload, which allows you to see UI changes in real-time on a running emulator or device as you type the code.
| Feature | WPF | .NET MAUI |
|---|---|---|
| Primary Platform | Windows Desktop | iOS, Android, macOS, Windows |
| XAML Dialect | Desktop-focused (Window, TextBlock) | Mobile-first/Universal (ContentPage, Label) |
| Graphics Engine | DirectX (High performance) | Native OS controls (via Handlers) |
| Visual Designer | Drag-and-drop support | XAML Hot Reload only |
| Data Binding | Standard {Binding} | Standard {Binding} + Compiled Bindings {x:Bind} |
While the transition for a WPF developer to MAUI is relatively straightforward due to shared concepts like MVVM (Model-View-ViewModel) and Data Binding, you cannot simply copy-paste XAML files from one to the other without significant renaming and structural adjustments.
| Aspect | WPF | MAUI |
|---|---|---|
| Platform | Windows desktop only | Cross-platform (Android, iOS, macOS, Windows) |
| UI richness | Advanced desktop graphics, triggers, animations | Mobile-friendly controls, responsive layouts |
| Navigation | Window-based, manual navigation | Shell-based, route navigation |
| Resources | Desktop resource dictionaries | Shared resources with platform overrides |
| Ecosystem | Mature, stable, Windows-focused | Newer, evolving, cross-platform |
WPF XAML is best for powerful Windows desktop applications with advanced UI needs. MAUI XAML is ideal for cross-platform apps where code and UI can be shared across mobile and desktop.
| MAUI-Project-Structure | MAUI-Features | |