* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.1 KiB
title, ms.date, helpviewer_keywords, ms.assetid, author, ms.author, manager
| title | ms.date | helpviewer_keywords | ms.assetid | author | ms.author | manager | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| How to: Copy and Paste an ElementHost Control at Design Time | 03/30/2017 |
|
e570375d-2a68-44ba-b4f7-c781af2d20e8 | jillre | jillfra | jillfra |
How to: Copy and paste an ElementHost control
This procedure shows you how to copy a Windows Presentation Foundation (WPF) control on a Windows Form in Visual Studio.
-
In Visual Studio, add a new WPF xref:System.Windows.Controls.UserControl to a Windows Forms project. Use the default name for the control type,
UserControl1.xaml. For more information, see Walkthrough: Creating New WPF Content on Windows Forms at Design Time. -
In the Properties window, set the value of the xref:System.Windows.FrameworkElement.Width%2A and xref:System.Windows.FrameworkElement.Height%2A properties of
UserControl1to 200. -
Set the value of the xref:System.Windows.Controls.Control.Background%2A property to Blue.
-
Build the project.
-
Open
Form1in the Windows Forms Designer. -
From the Toolbox, drag an instance of
UserControl1onto the form.An instance of
UserControl1is hosted in a new xref:System.Windows.Forms.Integration.ElementHost control namedelementHost1. -
With
elementHost1selected, press Ctrl+C to copy it to the clipboard. -
Press Ctrl+V to paste the copied control onto the form.
A new xref:System.Windows.Forms.Integration.ElementHost control named
elementHost2is created on the form.