Reputation: 31
Is it possible to create common controls that can be used for both UWP and WPF applications?
Tried digging over the .NET and found out that code can be shared across them using .NET Standard but what about XAML controls/UI ?
Upvotes: 3
Views: 1078
Reputation: 39072
You can't directly use WPF controls in UWP apps, as there are many features of WPF XAML which are not yet available in UWP. So direct forward compatibility is not available here. Evenso, upgrading existing WPF controls to UWP should not be too hard, usually all it takes is to rewrite some parts of XAML but the actual business logic behind them can be ported 1:1, as most is covered by .NET Standard.
However, at Build 2018 Microsoft announced UWP XAML Islands functionality, that will allow developers to upgrade the UI of WPF apps to modern UWP design, including Fluent Design System features. In the near future you will be able to do this with all UWP controls (including custom), once the APIs are ready, but currently you can at least use the modern UWP WebView control in WPF, which is part of the Windows Community Toolkit.
Upvotes: 2