question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to embed native control or get native handle of existing control

See original GitHub issue

I’m working on video player (GStreamer based) and want to render video inside Avalonia app.

I’m using Panel in WinForms app as video window.

I need some area inside Avalonia window (Panel for example) that can provide native window handle to draw on it. It’s possible for Win32 control or Gtk controls for example.

I can get handle for entire Window but that’s not what I need.

var screenHandle = ((Avalonia.Win32.WindowImpl) ((TopLevel) pnScreen.GetVisualRoot())?.PlatformImpl)?.Handle?.Handle ?? IntPtr.Zero;

As alternative maybe some way to embed native platform controls that have handle into Avalonia window.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
kekekekscommented, Jul 2, 2020
2reactions
raidenXRcommented, Aug 23, 2020

is it possible to embed SDL2 windows on AvaloniaUI? I did try to do that on WPF with HwndHost, but the BuildWindowCore() throws an InvalidOperationException when returning the HandleRef.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Embedding Native (Windows and Linux) Views/Controls ...
This article describes embedding native Windows and Linux control into an Avalonia application.
Read more >
Hosting a native control in WPF - c++
I have a native control, written in C++ and using DirectX 11, that I would like to embed within a WPF application. Currently...
Read more >
Native embedding - .NET MAUI
Pages, layouts, and views all derive from Element. Native embedding enables any .NET MAUI controls that derive from Element to be consumed in...
Read more >
Hosting Native Controls – Moving from Xamarin Forms ...
Learn how to migrate custom renderers from Xamarin Forms to Uno Platform. Explore the process of customizing native platform controls using ...
Read more >
Adding an event handler to a native control - ERP 10
You can make event handlers for native controls. Just make sure to do everything the Wizard does. edit. Here's the steps. Declare an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found