Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

ElementHost won't render WPF User Control

$
0
0
With VS 2008 SP1 and a C# Windows Forms application, ElementHost will not render a WPF UserControl at design time or run time.  I have created the simplest possible project to demonstrate the problem.  In the project, there's a Form with no controls on it other than an ElementHost and a WPF user control with a static label.  When I set the WPF UserControl as the Child of the ElementHost, I see "Unable to generate a preview for userControl1 due to an unhandled exception during its initialization. Make sure that the hosted content contains no build errors" in design view.  The project compiles with no errors or warnings.  At runtime there are no errors but the WPF UserControl does not render.  A breakpoint in the WPF UserControl's constructor is hit when the winform loads.

In addition, I do not see the "WPF Integration" tab in my VS Toolbox.  I had to manually add that tab group and the ElementHost item to the toolbox.  My WinForms project references PresentationCore, PresentationFramework, WindowsBase, and WindowsFormsIntegration.

Anyone else experienced this problem?

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>