2

There is an application which consists or two parts - WPF user interface and C++ dll with math and Opengl graphics. The WPF user interface has WindowsFormsHost with a Windows Forms Label in it. The handle of the label is used to draw graphics using Opengl.

Now the application should be made cross-platform. Avalonia is a good choice as a user interface part, but unfortunately I did not managed to find if it is possible to embed a window with native handle in an Avalonia window?

Is there something like WindowsFormsHost of WPF or another control?

Ilya
  • 21
  • 3

1 Answers1

0

I have found the solution:

  1. a class inherited from NativeControlHost should be created.
  2. CreateNativeControlCore function should be overriden;
  3. in the function the following code should be placed:

var piHandle = base.CreateNativeControlCore(parent);
//this is the handle
m_Handle = piHandle.Handle;

As the result a window with the handle m_Handle will be created.

Ilya
  • 21
  • 3