简体   繁体   中英

XamlParseException Error Occured in WPF

I have created PRISM WPF Application. It has two Modules

  1. Wpf application, BootStapper, Shell

    1. Class Library, Contains *.resx files.

Here, i have created UserControl.xaml in WPF application and loaded *.resx file like below,

xmlns:ResxFile="clr-namespace:Books.Resources.English;assembly=Books.Resources"
 <cb:BaseView.Resources>
        <ResxFile:ScreenFieldNames x:Key="ScreenFieldNames"/>
    </cb:BaseView.Resources>


<TextBlock Text="{Binding AddField, Source={StaticResource ScreenFieldNames}, FallbackValue='Add Field'}" Grid.Row="1" Grid.Column="2"/>

But i am getting following error

An exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll but was not handled in user code

Additional information: 'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '62' and line position '20'.

Please help me on this

No need to add it as a Resource . You can access it directly since you have defined the namespace.

xmlns:ResxFile="clr-namespace:Books.Resources.English;assembly=Books.Resources"

<TextBlock Text="{x:Static ResxFile:ScreenFieldNames.AddField}"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM