Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 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 Width and Height properties of
UserControl1
to 200.Set the value of the Background property to Blue.
Build the project.
Open
Form1
in the Windows Forms Designer.From the Toolbox, drag an instance of
UserControl1
onto the form.An instance of
UserControl1
is hosted in a new ElementHost control namedelementHost1
.With
elementHost1
selected, press Ctrl+C to copy it to the clipboard.Press Ctrl+V to paste the copied control onto the form.
A new ElementHost control named
elementHost2
is created on the form.
See also
.NET Desktop feedback