Localizing attached properties in XAML/WinRT
localization, windows, windows-runtime, xaml
Solution
You need to handle attached properties a bit differently, i.e. their namespace must be included in the reource key like this:
FoldersPageAppBarAddFolderButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name
You can read more about it here.
Problem
I'm attempting to localize my WinRT app. I don't need anything too fancy, so I've been using x:Uid on XAML elements in conjunction with resource files that have properties such as "PageTitleTextBox.Text" set. This method was working great until I ran into an issue with attached properties. I've defined a few app bar buttons using similar markup to what I've seen in other examples: ``` <Button x:Name="AddFolderButton" Click="AddFolderButton_Tapped" x:Uid="FoldersPageAppBarAddFolderButton" AutomationProperties.Name="Test" Style="{StaticResource AppBarButtonStyle}"> <Button.Content></Button.Content> </Button > ``` In this case, I'd like to localize AddFolderButton's label, currently defined by `AutomationProperties.Name`. I tried setting a key in my resource file to `FoldersPageAppBarAddFolderButton.AutomationProperties.Name`, but this fails on runtime. Is it possible to localize this label using XAML, or do I need to do this programatically in the code-behind file?