Igor Kulman
Igor Kulman

Reputation: 16361

How to localize AppBar buttons

I have a Windows 8 Metro application created from the Grid Application template. I need to localize the buttons in the AppBar. Normaly I use x:Uid and .resw for localization but this does not work for the navigation buttons in AppBar.

For example, for the Home button I need to localize the "Home" text. The "Home" text is defined in StandardStyles.xaml as follows:

<Setter Property="AutomationProperties.Name" Value="Home"/>

I tried defining HomeButton.AutomationProperties.Name in resw but I get

Unable to resolve property 'AutomationProperties.Name' while processing properties for Uid

Can anyone help?

Upvotes: 25

Views: 6808

Answers (1)

Tim Heuer
Tim Heuer

Reputation: 4311

take a look at http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh965329.aspx where it shows how to use the right RESW syntax for an attached property like this. So if you are using the button styles you could do something like this:

<Button Style="{StaticResource HomeAppBarButtonStyle}" x:Uid="HomeButton" />

And then in your RESW you'd have:

HomeButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name

as your key value.

Hope this helps!

Upvotes: 38

Related Questions