The name XXX does not exist in the namespace YYY (

2020-08-09 08:10发布

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

标签: xaml
8条回答
Evening l夕情丶
2楼-- · 2020-08-09 08:31

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;)

查看更多
smile是对你的礼貌
3楼-- · 2020-08-09 08:33

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.

查看更多
登录 后发表回答