How to create a WinForms Form as a DockableContent in AvalonDock?

I can use WinForms controls, but not the whole form:

var foo = new DockableContent(); foo.Title = "Foo"; foo.Name = "FooName"; var c = new WindowsAppFramework.RenderTargetUserControl(); c.Dock = System.Windows.Forms.DockStyle.Fill; c.AutomaticUpdateFPS = 60; var host = new System.Windows.Forms.Integration.WindowsFormsHost(); host.Child = c; foo.Content = host; foo.ShowAsDocument(dockManager); foo.Focus(); 

Is it possible to use the whole form? I want to use existing forms in an application.

+4
source share
1 answer

You can turn the form into a child control:

  var frm = new Form1(); frm.TopLevel = false; frm.Visible = true; frm.FormBorderStyle = FormBorderStyle.None; 

Which essentially turns it into a UserControl.

+7
source

Source: https://habr.com/ru/post/1315361/


All Articles