I've been playing around with user controls and built myself a little control with just a textbox and a button called "SpecialControlObject" to test something.
XAML:
<UserControl x:Class="CustomControlTest.SpecialControlObject"
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"
xmlns:local="clr-namespace:CustomControlTest"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="100">
<Grid>
<StackPanel>
<TextBox Width="50"/>
<Button Height="20" Width="20" Margin="0,20,0,0"/>
</StackPanel>
</Grid>
</UserControl>
Everything fine so far.
I now implemented it into my MainWindow just like that:
XAML:
<Window x:Class="CustomControlTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CustomControlTest"
mc:Ignorable="d"
Title="MainWindow" Height="300" Width="300">
<Grid>
<local:SpecialControlObject x:Name="UserControl1" Height="100" Width="100"/>
</Grid>
</Window>
If I compile this, everything works fine and the user control gets displayed correctly.
But the Visual Studio designer can't display it and throws following error:
"The element UserControl1 of type CustomControlTest.SpecialControlObject could not be displayed."
As well as VS giving me the following:
"Could not load file or assembly 'CustomControlTest, Version1.0.0.0, Culture=neutral, PublicKeyToken=null.' The module was expected to contain an assembly manifest."
I've added a app.manifest file, and changed the user controls Copy To Output Directory property to Copy always but this doesn't seem to fix it.
What am I missing here?