C# Can';“找不到”;资源“;wpf中的文件

C# Can';“找不到”;资源“;wpf中的文件,c#,wpf,xaml,resources,resx,C#,Wpf,Xaml,Resources,Resx,我是WPF的新手。 我需要在资源文件resx上添加引用并从中获取字符串 <Window x:Class="SelectObjectsWindow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:res="clr-namespace:Sel

我是WPF的新手。 我需要在资源文件resx上添加引用并从中获取字符串

<Window x:Class="SelectObjectsWindow.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:res="clr-namespace:SelectObjectsWindow.Properties"

    Title="{x:Static res:Resources.Res1}" Height="350" Width="525">
<Grid>
    ....
</Grid>

有人知道怎么回事吗?

尝试添加程序集引用:

xmlns:res="clr-namespace:SelectObjectsWindow.Properties;assembly=[AssemblyName]"

将[AssemblyName]替换为程序集的名称,可以通过右键单击项目并选择“属性”找到该名称,转到“应用程序”选项卡并查看程序集名称:

将访问修饰符从“内部”更改为“公共”,绑定将正常工作。

如果将其设置为“公共”,则看起来像是编译器误报。它编译吗?如果不是,问题不在您的窗口中,而是在其他窗口中。(XAML Intellisene/编译器有点难理解)您找到过解决方案吗?请确保XAML指向的类是公共的,然后保存并重新打开该解决方案。你能不能也给我看看你要指向的类。把你的代码贴在dropbox上,我会看看。我的窗口显示resx文件中的正确标题。
xmlns:res="clr-namespace:SelectObjectsWindow.Properties;assembly=[AssemblyName]"