Reputation: 5796
I'm trying to display some text from Resources in a TextBox. In my Properties.Resources
, I have a string resource named DefaultUrl
.
I'm using the following code to display it in the TextBox:
<Window x:Class="........"
...
...
xmlns:properties="clr-namespace:project_name.Properties">
<TextBox Text="{x:Static properties:Resources.DefaultUrl}"/>
</Window>
On building the project, it correctly displays the resource value in the TextBox, but on running the project, it gives me the following error:
Exception thrown: 'System.ArgumentException' in System.Xaml.dll Exception thrown: 'System.Xaml.XamlObjectWriterException' in System.Xaml.dll Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
'Provide value on 'System.Windows.Markup.StaticExtension' threw an exception.' Line number '725' and line position '149'.
How can I display Properties.Resources string in XAML ??
Upvotes: 0
Views: 971
Reputation: 5796
Solution:
Going with @Max and @Styx comments, I was able to resolve this issue by changing the access modifier dropdown ( in Project resources ) value from Internal
to Public
Upvotes: 1