I can successfully add controls defined in my Assets assembly in my main project.
For example, a control like this:
using System.Windows.Controls;
namespace AdvancedAudioGui.Assets.Controls
{
public class MyControl: Control
{
public string MyProperty { get; set; }
}
}
works like this:
<UserControl x:Class="MyCompanyName.AdvancedAudioGui.Parts.MyPart"
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:controls="clr-namespace:AdvancedAudioGui.Assets.Controls;assembly=AdvancedAudioGui.Assets"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<controls:MyControl />
</Grid>
but not like this (Note: the same thing happens with Name or event handlers like MouseDown):
<UserControl x:Class="MyCompanyName.AdvancedAudioGui.Parts.MyPart"
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:controls="clr-namespace:AdvancedAudioGui.Assets.Controls;assembly=AdvancedAudioGui.Assets"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<controls:MyControl x:Name="MyInstance"/>
</Grid>
I get the error:
The type or namespace name 'Assets' does not exist in the namespace 'OurCompanyName.AdvancedAudioGui' (are you missing an assembly reference?)
If I create them in code behind I can add a name so it must be a xmlns issue, but I can't see it. Any ideas?
Thanks!