Hi,@mehmet yılmaz . Welcome Microsoft Q&A.
You could use a WinUI 3 class library in a WPF application, but with certain considerations.
WinUI 3 is targets Windows App SDK, while WPF is a separate framework with its own set of controls and runtime. While WinUI 3 and WPF share some common XAML concepts, they are not directly interchangeable.
And WinUI 3 is part of the Windows App SDK—so, naturally, a WinUI 3 app can use the other Windows App SDK features and APIs, as well. For how you can use Windows App SDK APIs (and Windows Runtime APIs) in a WPF app, you could refer to the document Use the Windows App SDK in a WPF app.
Here are a few points to consider:
UWP Control Compatibility: If you're using WinUI 3 controls in a UWP app, the Uno Platform should provide good compatibility. However, if you're looking to use WinUI 3 controls in a WPF app, you might run into issues because WPF and UWP have different application models, layout systems, and runtime environments.
WPF and Uno Platform: While Uno Platform aims to bring UWP features to other platforms, including WPF might not be a straightforward process. It's best to consult the Uno Platform documentation and resources to understand their compatibility and recommended practices for different scenarios.
Porting to Uno Platform: If your goal is to port your WPF app to Uno Platform for cross-platform compatibility, you'll likely need to adapt your UI code, as well as any platform-specific features or APIs you're using. While some code and XAML might be reusable, there might still be platform-specific adjustments required.
WinUI 3 and WPF: If you want to use WinUI 3 controls in a WPF app, it might be more practical to look for equivalent controls or solutions that are native to WPF.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.