Category / Section
How to host the Spreadsheet control of WPF in Windows Forms?
1 min read
Host WPF spreadsheet in WF
In order to
host the Spreadsheet control of WPF in Windows Forms, make use of the ElementHost Container.
This support is provided by Microsoft for hosting WPF controls in a Windows Forms
application.
For more details, please refer to this link: Hosting WPF control in WinForms
ElementHost elhost = new ElementHost();
elhost.Size = new System.Drawing.Size(1000, 600);
Spreadsheet wpfctl = new Spreadsheet();
elhost.Child = wpfctl;
this.Controls.Add(elhost);Dim elhost As New ElementHost()
elhost.Size = New System.Drawing.Size(1000, 600)
Dim wpfctl As New Spreadsheet()
elhost.Child = wpfctl
Me.Controls.Add(elhost)The output is
as follows:

Samples: