Open reli-msft opened 4 years ago
Hi @reli-msft - thanks for the suggestion! We've been talking about the very same thing internally, and it's on our internal backlog already.
At the moment, we're spending pretty much all our time on WinUI 3, so that'll come before this feature - which means this'll be parked on the backlog for a good while.
To help us out, could you describe more about which legacy controls you'd like to host inside XAML, so we can capture your requirements? My thought at the moment is that we'd make a way to host an HWND to interop with as many legacy technologies as possible - but I could imagine we could build "interop helper libraries" to common technologies - much like how WPF has a way to more easily host Windows Forms controls, which is just a helper/wrapper atop WPF's HwndHost.
Are the legacy controls in your case from WPF? Windows Forms? MFC?
I imagine a HWND host control, could only work with an un-sandboxed WinUI 3 app
We also have similar problem. Right now we have WPF app that uses lot of c++ code through HwndHost control. We are planing to move Wpf app to WinUI and moving Xaml works great without problems, but what about HwndHost, is this going to be possible with WinUI3. In our case we are doing interoperability with DirectShow through HwndHost and right now in WinUI 2 , this is not possible. What will be realistic date to use HwndHost in WinUI3? Also is this new Xaml Window and Application like discussed at latest February WinUI Community call, could help or not?
In our case we have a MFC control (yes, that's a very old application).
I am curious about this from WinForms, have an old application I received which I am trying to modernise.
Currently looking at XAML islands. The hardest part is the custom painting (System.Drawing) code.
Also unsure what a good replacement for that would be, since in WinUI there is no Win2D support yet and also no SkiaSharp.
I also would want this. I am using windowless Rich Edit controls to render complex text layouts, but that control will only render into a raw HDC
. Without the ability to host a raw WinForms control in the XAML tree that Rich Edit can use, I am forced to use multiple top-level Islands, which I understand is very buggy right now.
Edit: Check that. It turns out I can get an HDC out of a DirectX-based rendering infrastructure using ID2D1GdiInteropRenderTarget
, but I don't know how easy that will be to integrate into a WinUI app. (The only way I know of to initialize Direct2D to draw into a HDC
requires an HWND
, and the docs are ambiguous as to what other kinds of render targets support ID2DGdiInteropRenderTarget
.)
Discussion: Legacy Pond (Legacy control container in XAML) for XAML Desktop
A long-lasting application may have many legacy controls that needs to be hosted inside XAML. Therefore, it would be valuable to create a legacy-in-XAML container, opposite to XAML Island, to allow WinUI to contain them and make these old controls work properly.