WPF 앱은 .NET 실행되지만 Windows Presentation Foundation XAML 스택을 사용합니다. WinUI 3은 최신 대체입니다. AI 마이그레이션의 핵심 과제는 WPF System.Windows.* 네임스페이스를 사용하는 반면 WinUI 3은 Microsoft.UI.Xaml.* 사용하며, 많은 컨트롤 및 창 API는 간단한 검색 및 바꾸기 대신 대상 대체가 필요하다는 것입니다.
WPF 마이그레이션 기술 설치
gh copilot plugin install winui@awesome-copilot
API 대체 테이블
Namespaces
| WPF |
WinUI 3 |
System.Windows.* |
Microsoft.UI.Xaml.* |
System.Windows.Controls.* |
Microsoft.UI.Xaml.Controls.* |
System.Windows.Media.* |
Microsoft.UI.Xaml.Media.* |
System.Windows.Data.* |
Microsoft.UI.Xaml.Data.* |
System.Windows.Input.* |
Microsoft.UI.Input.* |
컨트롤
| WPF |
WinUI 3 |
Notes |
Window |
Microsoft.UI.Xaml.Window |
다른 API 표면 |
Grid, StackPanel, Canvas |
변경 안 됨 |
동일한 이름 |
TextBox, Button, CheckBox |
변경 안 됨 |
동일한 이름, WinUI 스타일 지정 |
ListBox / ListView |
ListView |
새 코드에 사용 ItemsView |
DataGrid |
DataGrid (CommunityToolkit) |
CommunityToolkit.WinUI.Controls.DataGrid 추가 |
TabControl |
TabView |
다른 API |
Menu / MenuItem |
MenuBar / MenuBarItem |
|
ToolBar |
CommandBar |
|
RichTextBox |
RichEditBox |
|
WebBrowser |
WebView2 |
다른 API, 비동기 |
스레드 처리
| WPF |
WinUI 3 |
Dispatcher.Invoke(...) |
DispatcherQueue.TryEnqueue(...) |
Dispatcher.BeginInvoke(...) |
DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, ...) |
Application.Current.Dispatcher |
this.DispatcherQueue |
창 관리 및 DPI
| WPF |
WinUI 3 |
Window.WindowState |
AppWindow.Presenter (사용 OverlappedPresenter) |
SystemParameters.WorkArea |
DisplayArea.GetFromWindowId(...) |
PresentationSource.FromVisual() |
WinRT.Interop.WindowNative.GetWindowHandle(window) |
데이터 바인딩
| WPF |
WinUI 3 |
INotifyPropertyChanged |
변경 안 됨 |
ObservableCollection<T> |
변경 안 됨 |
{Binding} |
{x:Bind} 기본 설정(컴파일 시간) |
DependencyProperty |
변경 안 됨 |
IValueConverter |
변경 안 됨 |
리소스 및 스타일
| WPF |
WinUI 3 |
ResourceDictionary |
변경 안 됨 |
StaticResource |
변경 안 됨 |
DynamicResource |
{ThemeResource} 시스템 색상용 |
SystemColors.WindowBrush |
{ThemeResource SystemFillColorSolidNeutralBrush} |
시작 프롬프트
I'm migrating a WPF app to WinUI 3 using the Windows App SDK.
Apply these substitutions:
- System.Windows.* → Microsoft.UI.Xaml.*
- Dispatcher.Invoke / BeginInvoke → DispatcherQueue.TryEnqueue
- Window.WindowState → AppWindow with OverlappedPresenter
- PresentationSource → WinRT.Interop.WindowNative.GetWindowHandle
- DynamicResource for system colors → ThemeResource
- {Binding} → {x:Bind} where possible (compile-time binding)
- ListBox → ListView or ItemsView
- TabControl → TabView
- WebBrowser → WebView2
- DataGrid → CommunityToolkit.WinUI.Controls.DataGrid
Do not use any System.Windows.* namespaces in new code.
Do not use Dispatcher.Invoke — use DispatcherQueue.TryEnqueue.
Flag APIs without a direct WinUI 3 equivalent rather than guessing.
프로젝트 파일 변경
<!-- Before (WPF) -->
<TargetFramework>net10.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<!-- After (WinUI 3) -->
<TargetFramework>net10.0-windows10.0.19041.0</TargetFramework>
<WindowsSdkPackageVersion>10.0.19041.31</WindowsSdkPackageVersion>
dotnet add package Microsoft.WindowsAppSDK
직접 마이그레이션하지 않는 API
에이전트에게 이것들은 추측하지 말고 표시하라고 지시하세요.
- WPF
Adorner 계층 - WinUI 3에 해당되지 않음
- WPF
FlowDocument / DocumentViewer - 편집 가능한 콘텐츠에 RichEditBox 사용하며, 해당 뷰어는 없습니다.
- WPF
Viewport3D - Win2D 또는 DirectX interop 사용
- 에어스페이스/HWND 호스팅 —
SwapChainPanel 또는 Win32 상호 운용 패턴 사용
관련 콘텐츠