本地化应用栏按钮文本 [英] Localizing App bar button text

查看:82
本文介绍了本地化应用栏按钮文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好


我有一个自定义应用栏按钮,定义了以下样式:


<样式x:键=" ; ChangePinAppBarButtonStyle"的TargetType = QUOT;按钮和QUOT; BasedOn =" {StaticResource AppBarButtonStyle}"&
        < Setter Property =" AutomationProperties.AutomationId" Value =" ChangePinAppBarButton" />

        < Setter Property =" AutomationProperties.Name" Value =" Change Pin"&
        < Setter Property =" Content"值="&#xE0A8;" />

 < / Style>


我的要求是本地化按钮名称属性 价值"更改订单"。


任何帮助将不胜感激。按钮目前在XAML文件中定义。不介意更改代码以在代码中生成它们(c#代码隐藏文件)。但请告诉我是否可以在XAML中进行此操作。



提前致谢!


解决方案

您不会在风格中进行本地化,而是使用按钮。 最简单的方法是使用x:Uid方法。 查看应用程序资源SDK示例。

http://code.msdn.microsoft.com/windowsapps/应用程序资源和 - cd0c6eaa


Hi All

I have a custom app bar button with following style defined :

<Style x:Key="ChangePinAppBarButtonStyle" TargetType="Button" BasedOn="{StaticResource AppBarButtonStyle}">
        <Setter Property="AutomationProperties.AutomationId" Value="ChangePinAppBarButton"/>
        <Setter Property="AutomationProperties.Name" Value="Change Pin"/>
        <Setter Property="Content" Value="&#xE0A8;"/>
 </Style>

My Requirement is to localize the button name property value "Change Pin".

Any help would be appreciated. Buttons are defined in the XAML file currently. Wont mind changing to code to generate them in code (c# code behind file). But do let me know if its possible to do it in XAML itself.

Thanks in Advance!

解决方案

You would not localize in the style, but rather in the use of the button.  The easiest way is to use the x:Uid approach.  Look at the application resources SDK sample. http://code.msdn.microsoft.com/windowsapps/Application-resources-and-cd0c6eaa


这篇关于本地化应用栏按钮文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆