Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 898
Igor Kulman Avatar asked Apr 07 '12 14:04

Igor Kulman


1 Answers

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!

like image 131
Tim Heuer Avatar answered Oct 21 '22 02:10

Tim Heuer