TheSpy
TheSpy

Reputation: 263

Strings.resx cannot be accessed?

   <Window x:Class="AFICController.View.WizardDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:view="clr-namespace AFICController.View"
    xmlns:res="clr-namespace AFICController.Resources"
    Title="{x:Static res:Strings.WizardWelcomeWindow_Title}"
    ShowInTaskbar="True"
    Width="800"
    Height="600"
    WindowStartupLocation="CenterScreen"
    WindowStyle="SingleBorderWindow"
    BorderBrush="#003B7B"
    BorderThickness="0"
    ResizeMode="CanResize"
    Icon="/AFICController;component/Resources/Images/att_icon.ico" 
    >

   <view:WizardView Loaded="WizardView_Loaded_1"/>

  </Window>

I want to access my Strings.resx file from my WPF window but it give me following error :

"Strings" does not exist in the namespace "clr-namespace AFICController.Resources".
C:\Users\systellex\Dropbox\Projects\AFICController\AFICController\View\WizardDialog.xaml
\AFICController

I know the problem is at "Title="{x:Static res:Strings.WizardWelcomeWindow_Title}" but I dont know how to sort out the actual error? Can anyone explain where the exact problem exists? Any help would be highly appreciable?

Upvotes: 1

Views: 595

Answers (3)

Sankarann
Sankarann

Reputation: 2665

This will also works for..

Also change the Access modifier of your Resource file to Public

enter image description here

Title="{Binding Source={x:Static res:Strings.WizardWelcomeWindow_Title}}"

Upvotes: 1

Sukram
Sukram

Reputation: 466

Check you resx-file you have to set the access modificator to public. Otherwise, no static access methods are created

Upvotes: 0

gomi42
gomi42

Reputation: 2519

That depends a bit on your project setup. Very common is

Title="{x:Static Properties.Resources.WizardWelcomeWindow_Title}"

Upvotes: 0

Related Questions