Skip to content

WinFormsControlHost<T> ​

A NativeControlHost descendent which creates a WinForms control and keeps it alive and in memory, even when the hosting view is detached from the visual tree. Destruction/disposal of the control has to be invoked manually by implementing the IDisposeWinFormsControl interface on your view model and raising the DisposeWinFormsControl event.

Type ​

csharp
public class WinFormsControlHost<T> : NativeControlHost where T : Control

Namespace: RoyalApps.Community.Avalonia.Windows.NativeControls

View source

Properties ​

Control (T?) ​

The WinForms control.

Methods ​

OnCreateWinFormsControl() ​

Returns: T?. An instance of the WinForms control to host.

Override this method to create the WinForms control instance yourself. If not implemented, the instance will be created automatically.

Back to API index

MIT Licensed