【发布时间】:2019-07-10 18:24:13
【问题描述】:
我正在尝试访问我在资源文件中的字符串。但我在文本块的文本中遇到错误。
“名称 UIResources”不存在于 "clr-命名空间:ProjectName.Resources"。"
文件存在,所有属性都是公开的。我做错了什么?
<Window x:Class="MyApp.Project1.TestWindow"
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:local="clr-namespace:MyApp.Project1"
xmlns:p="clr-namespace:MyApp.Project1.Resources"
mc:Ignorable="d"
Title="TestWindow" Height="300" Width="300">
<Grid>
<TextBlock Text="{x:Static p:UIResources.BARBUTTON_ABOUT}"></TextBlock>
</Grid>
【问题讨论】: