Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# &引用;物业;没有定义吗?_C#_Wpf - Fatal编程技术网

C# &引用;物业;没有定义吗?

C# &引用;物业;没有定义吗?,c#,wpf,C#,Wpf,我试图按照本教程介绍用户设置: 我定义了一个名称为选中的设置,类型为int,作用域为user。在App.xaml中,我有: <Application.Resources> <properties:Selected x:Key="Selected"/> </Application.Resources> 编辑: 解决了的! 您需要确保在某个地方定义了属性名称空间,如链接的示例所示: <Application x:Class="S

我试图按照本教程介绍用户设置:

我定义了一个名称为选中的设置,类型为int,作用域为user。在App.xaml中,我有:

<Application.Resources>
        <properties:Selected x:Key="Selected"/>
    </Application.Resources>

编辑: 解决了的!

您需要确保在某个地方定义了属性名称空间,如链接的示例所示:

<Application x:Class="SampleApp.App"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:properties="clr-namespace:SampleApp.Properties"
   Exit="OnExit"
   StartupUri="MainWindow.xaml">
     <Application.Resources>
         <properties:Settings x:Key="Settings" />
     </Application.Resources>
</Application>

注意这行:
xmlns:properties=“clr namespace:SampleApp.properties”


在该错误消失之前,您可能需要重新编译。

App.xaml的其余部分是什么样子的?该错误表明应用程序标记中没有类似xmlns:properties=“clr namespace:SampleApp.properties”的命名空间声明。