Muthukrishnan R
Muthukrishnan R

Reputation: 159

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

Upvotes: 1

Views: 1448

Answers (1)

d.moncada
d.moncada

Reputation: 17392

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}"/>

Upvotes: 2

Related Questions