views:

25

answers:

1

In my WPF 4.0 desktop-based application in order to localize my application (e.g. English & French localizations) I'm using Resources.resx file, where I type dialog name (ID) and its value for English and French localization. Everything works great, except one thing — IntelliSense of Visual Studio 2010.

Let's say, I have a button:

<Button x:Name="Toolbar_Search_Button"
        Content="{x:Static res:Resources.Toolbar_Search_Button}" />

Where I want to put its content (label on the button) in English and in French as well, in order to do this I added to Resources.resx and Resources.fr.resx string with ID «Toolbar_Search_Button» and gave a value for each of them (Search/Recherche) and now I have to assign the string ID to button's content property. In my case I have to write all this long string: «x:Static res:Resources.Toolbar_Search_Button» and IntelliSense doesn't help me at all. The only thing that it suggests me is «Member=», but I want that when I type «res:Resources.» it gives me all existed strings ID, as we can usually see when IntelliSense is enabled.

I checked VS2010 preferences, IntelliSense is enabled for all kinds of projects/languages and it works when I write other XAML/C# code, like when I type «Wi» it suggests me «Width» etc.

My question is: How to enabled IntelliSense for localization/Resources? That I could type «res:Resources.» and see all localization resources strings that I have.

Thanks a lot.

+1  A: 

I have exactly the same problem. I don't believe Microsoft is stupid enough to disable that bit of intellisense via some unset option/setting for a default Visual Studio 2010 install.

But I do belive Microsoft is stupid enough not to implement the feature in VS 2010. I could have forgiven them VS 2008, since that was the first proper implementation of XAML design support (VS 2005 plugin is something else). Lack of implementation could perhaps have something to do with the fact if you write a string in your resx file and then specify the key value in XAML, XAML will start complaining that the new key does not exist in your resx file. Once you build your application will XAML start accepting the new key.

Mind you, XAML has horrid intellisense support to begin with. Take for instance the new and improved intellisense in code behind - if you type ".Cust", intellisense will offer both "Customer" and "ExistingCustomer". But the same feature is not implemented in XAML intellisense. There are more such examples...

So to answer your question - you can't enable resx intellisense support in XAML, at least I'm not aware of such a possibility.

Marko