Reputation: 470
So I'm working in VS12 on Windows 8, and hacking the ContosoCookbook code to make a different app. I'm trying to set up a "MainMenu.xaml" page and in I have:
<CollectionViewSource
x:Name="groupedItemsViewSource"
Source="{Binding Groups}"
IsSourceGrouped="true"
ItemsPath="TopItems"
d:Source="{Binding AllGroups, Source={d:DesignInstance Type=data:FlashCardDataSource, IsDesignTimeCreatable=True}}"/>
The error I'm getting is: The name "FlashCardDataSource" does not exist in the namespace "using:FlashCards.Data".
...but I don't understand how it doesn't. Where do I start looking? I'm new at XAML.
-Ken
Upvotes: 18
Views: 15330
Reputation: 11
If you are certain the class is present in the right namespace, just right click on the project in VS and choose Unload. Then Reload the project. This makes it re-evaluate all the namespaces and was the only cure for the issue I've found (when it really persistently won't acknowledge you classes;)
Upvotes: 1
Reputation: 1118
None of the above worked for me, but simply adding another dummy class to the folder containing the class it claimed did not exist seemed to do the trick. Maybe it made VS have another look.
Upvotes: 0
Reputation: 7171
In my case, I clean all the property value relative to the binding I assign by code in all class, then all become normal.
I think if giving value to the property that using in bindings at the same time in some wrong position in class will cause problem, so remove all the assignment code relative to the property may help.
Upvotes: 0
Reputation: 7215
Generally this error is caused by one of the following:
Upvotes: 5
Reputation: 5683
Check every class and xaml file for namespaces (even in App.xaml and MainWindow.xaml). Make sure you are not confusing the x:Class
in the top element of the file with a namespace.
Sometimes it indeed looks like a bug, but it's just one namespace somewhere that's independent of everything else that mixes up everything.
Upvotes: 2
Reputation: 1056
If nothing else is possible, comment the lines which use the namespace, rebuild, and then build the full project again.
I also tried rebuilding the project, reopening Visual Studio. Nothing helped. I finally commented xaml
, rebuilt the project, uncommented xaml
and it finally worked! Strange issue.
Upvotes: 18
Reputation: 830
If cleaning and rebuilding does not help, try restarting Visual Studio. Worked for me.
Upvotes: 12
Reputation: 116
Did you try to rebuild your project? Maybe clean the project and rebuild again.
Upvotes: 2