WPF / XAML编译但XAML中的错误

时间:2021-02-01 15:29:09

With a colleague, we try to make a POC of a WPF application. We created a new project with a page and a resx file to test internationalization (we are French). The application work well, no error on the compile and the resx file give good data. but in the XAML file, we have a lot of errors.

与同事一起,我们尝试制作WPF应用程序的POC。我们创建了一个带有页面和resx文件的新项目来测试国际化(我们是法语)。应用程序运行良好,编译没有错误,resx文件提供了良好的数据。但是在XAML文件中,我们有很多错误。

here is the XAML header :

这是XAML标题:

<Window x:Class="MAPPrintProcessEditor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:res="clr-namespace:MAPPrintProcessEditor.Properties"
        mc:Ignorable="d"
        Title="MAP Print Process Editor"
        WindowStartupLocation="CenterScreen"
        Height="{Binding SystemParameters.PrimaryScreenHeight}" Width="{Binding SystemParameters.PrimaryScreenWidth}">

here, is a line marked in error :

这里是一条错误标记的行:

...
                <MenuItem Header="{x:Static res:Resources.MenuItemHeaderClose}">
                    <MenuItem.Icon>
                        <Image Source="pack://application:,,,/Resources/Close-16.png"/>
                    </MenuItem.Icon>
                </MenuItem>
...

Visual Studio underline only this part :

Visual Studio仅为此部分加下划线:

Header="{x:Static

and finaly, here is the error message : The name "Resources" does not exist in the namespace "clr-namespace:PrintProcessEditor.Properties"

最后,这里是错误消息:名称“Resources”在命名空间“clr-namespace:PrintProcessEditor.Properties”中不存在

what is wrong in this code ?

这段代码有什么问题?

Thanks for reading

谢谢阅读

1 个解决方案

#1


0  

If the you can build correctly than just ignore that message and use BLEND to design your app.

如果您可以正确构建而不是忽略该消息并使用BLEND设计您的应用程序。

#1


0  

If the you can build correctly than just ignore that message and use BLEND to design your app.

如果您可以正确构建而不是忽略该消息并使用BLEND设计您的应用程序。