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 -->
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 declarationGood luck 😉