Contenuto generato con l’IA

010: Migrating WPF apps to .NET MAUI

20 mar 2026 · 43 min. 23 sec.
010: Migrating WPF apps to .NET MAUI
Descrizione

Another NotebookLM job. Bit of a rush, only 73 sources. Had a request to get a WPF tool working on a Mac. Not important, but a chance to grow my...

mostra di più
Another NotebookLM job. Bit of a rush, only 73 sources.
Had a request to get a WPF tool working on a Mac. Not important, but a chance to grow my skillz. So Here's the first of two covering it.

Notebook LM Prompt:

```
This is Episode 10 of News Re-Download, a podcast talking about software engineering. We're going over how to migrate a dot net 8 WPF app to dot net MAUI without losing the WPF build. We want a project with two front ends so we can explore growing from WPF developers, to XAML developers.
### Concise Guide: .NET MAUI Windows Frontend & Auto-Update Deployment
**1. Architecture & Project Setup**
*   **Create Project:** Add a new .NET MAUI App named `JiraMinion.MAUI` to your solution, targeting Windows. 
*   **Link Shared Logic:** Add a project reference to `JiraMinion.Shared` so you can reuse all ViewModels and business logic.
*   **Dependency Injection:** Register your shared ViewModels and MAUI-specific services in the `MauiProgram.cs` bootstrap class.
**2. Translating the UI (XAML Migration)**
WPF and MAUI XAML cannot be shared directly because MAUI uses the 2009 XAML specification, and its controls derive from `VisualElement` instead of `FrameworkElement`.
*   **Control Mapping:** Translate `Window` to `ContentPage`, `StackPanel` to `VerticalStackLayout` or `HorizontalStackLayout`, `TextBlock` to `Label`, and `TextBox` to `Entry` (single-line) or `Editor` (multi-line).
*   **Layout & Alignment:** Replace `HorizontalAlignment` with `HorizontalOptions` using values like `Start`, `Center`, or `Fill`.
*   **Data Binding:** MAUI uses Compiled Bindings by default for better performance. You must explicitly set `x:DataType` on your data templates. `RelativeSource` bindings (like `FindAncestor`) are much stricter in MAUI; if visual tree boundaries break, use `x:Reference` to target named elements instead.
**3. Platform-Specific Services**
*   **Cross-Platform APIs:** Replace your WPF Win32 service implementations with MAUI's built-in abstractions. Use the `Microsoft.Maui.ApplicationModel.DataTransfer.Clipboard` API for your `IClipboardService` and `Microsoft.Maui.ApplicationModel.Launcher.OpenAsync` for your `IBrowserService`.
*   **Native Windows Code:** If you must use Windows-specific APIs (like the Windows Registry), place that code inside the `Platforms/Windows/` directory or use conditional compilation (`#if WINDOWS`) so it only compiles for the Windows build.
**4. Deployment (ClickOnce Equivalent)**
ClickOnce does not translate to MAUI's multi-platform packaging. The modern equivalent for Windows is **MSIX combined with an AppInstaller file**, which provides the exact same automatic update on launch experience.
*   **Publish the MSIX:** Build and publish your MAUI app as an `.msix` package.
*   **Create the `.appinstaller` File:** Create an XML file hosted on your network share that points to the network URI of the latest MSIX package.
*   **Configure Auto-Updates:** In the AppInstaller XML, include an `` block with ``. This instructs Windows to check the network share for a new version every time the user opens the application, applying updates automatically. Users install the app initially by running this `.appinstaller` file.
```

This episode includes AI-generated content.
mostra meno
Informazioni
Autore News ReDownload
Organizzazione Jarryd
Sito -
Tag

Sembra che non tu non abbia alcun episodio attivo

Sfoglia il catalogo di Spreaker per scoprire nuovi contenuti

Corrente

Copertina del podcast

Sembra che non ci sia nessun episodio nella tua coda

Sfoglia il catalogo di Spreaker per scoprire nuovi contenuti

Successivo

Copertina dell'episodio Copertina dell'episodio

Che silenzio che c’è...

È tempo di scoprire nuovi episodi!

Scopri
La tua Libreria
Cerca