This is killing me. I'm trying to test/debug a WPF UserControl library in Visual Studio 2010 with the User Control Test Container.exe. I keep getting the error "Assembly [...] doesn't contain any UserControls." This should be simple, and every msdn article and blog tutorial I've looked at suggests that it should all just work perfectly and magically.
Here's the code for a very simple test case which I cannot make work:
XAML:<UserControl x:Class="UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Label Content="Hello!" Height="28" HorizontalAlignment="Left" Margin="86,106,0,0" Name="Label1" VerticalAlignment="Top" />
</Grid>
Code Behind:
Public Class UserControl1
Inherits UserControl
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
End Class
Project File has debug options set to open UserControlTestContainer.exe, with ./MyTestLibrary.dll as a command-line arg.
Any sug开发者_如何学编程gestions on how to make this work?
Just to be sure, your User control is being hosted in a Window or something right? I am pretty certain you cannot display a usercontrol all by itself. What does your containing window look like?
The UserControl Test Container is only for libraries build using the Windows Control Library Project Template. Even then, it's a subset since Visual C++ controls can't be tested using it.
精彩评论