Reputation: 3516
I've created the following XAML, approximately (shortened for brevity):
<Window ...
xmlns:Models="clr-namespace:Project.Presentation.Models;assembly=Project"
...>
<Window.Resources>
<Models:ProfileCollection x:Key="Profiles" />
</Window.Resources>
</Window>
ProfileCollection is defined as, simply:
public class ProfileCollection : ObservableCollection<Profile>
{
public ProfileCollection()
{
foreach (Profile p in Configuration.Instance.Profiles)
this.Add(p);
}
// code that handles static added/removed events
}
This follows the requirements set forth in XAML and Custom Classes on MSDN.
However, when I try to compile I get this error:
error MC3074: The tag 'ProfileCollection' does not exist in XML namespace 'clr-Project.Presentation.Models;assembly=Project'. Line 18 Position 7.
I've also tried:
<Window ...
xmlns:SystemCollections="clr-namespace:System.Collections;assembly=mscorlib"
...>
<Window.Resources>
<SystemCollections:ArrayList x:Key="arrayList" />
</Window.Resources>
</Window>
That works fine.
public class SomeList : ArrayList { public SomeList() { } }
I get the same error trying to use this object. It's the same error as before.
<Models:SomeList x:Key="arrayList" /> <!-- MC3074 -->
Upvotes: 2
Views: 3913
Reputation: 1649
I got the same error. The reason were different .NET Frameworks (assembly had 4.6.1 and my base project had 4.5.1).
Maybe this information helps others (the error code is not very precise in my mind...).
Upvotes: 0
Reputation: 62504
Is 'ProfileCollection'
class placed in the namespace 'Project.Presentation.Models
? Also if XAML and class are both in 'Project'
assembly, try to remove "assembly=Project
" from xmlns declaration
Good luck ;)
Upvotes: 6