【问题标题】:Localize Listpicker Items in Windows Phone 7在 Windows Phone 7 中本地化 Listpicker 项目
【发布时间】:2012-04-28 23:53:03
【问题描述】:

我正在尝试在我的 windows phone 7 应用程序中使用 listpicker 控件,我已正确设置了 xaml,但我想使用我的资源文件中的字符串而不是我目前拥有的文字(用于 Yards 和 Meters)设置:

    <toolkit:ListPicker Header="{Binding Path=LocalizedResources.unit_of_length_title, Source={StaticResource LocalizedStrings}}">
        <sys:String>Yards</sys:String>
        <sys:String>Meters</sys:String>
    </toolkit:ListPicker>

我尝试了以下方法:

    <toolkit:ListPicker Header="{Binding Path=LocalizedResources.unit_of_length_title, Source={StaticResource LocalizedStrings}}">
        <sys:String>{Binding Path=LocalizedResources.measure_yards, Source={StaticResource LocalizedStrings}}</sys:String>
        <sys:String>{Binding Path=LocalizedResources.measure_meters, Source={StaticResource LocalizedStrings}}</sys:String>
    </toolkit:ListPicker>

但它没有绑定到资源字符串。我知道我可以创建一个数据模板并以这种方式绑定,但我正在寻找一个更简单的解决方案,有什么想法吗?

【问题讨论】:

  • 你看过为什么“它没有绑定到资源字符串”吗?
  • 我在谷歌上搜索得相当彻底,并在 SO 上进行了广泛搜索。似乎没有人真正将他们的 win 手机应用程序本地化。不过,似乎应该有一个简单的解决方案。

标签: windows-phone-7 xaml listpicker


【解决方案1】:

尝试以下方法:

<toolkit:ListPicker Header="{Binding Path=LocalizedResources.unit_of_length_title, Source={StaticResource LocalizedStrings}}">
    <toolkit:ListPickerItem Content="{Binding Path=LocalizedResources.measure_yards, Source={StaticResource LocalizedStrings}}"/>
    <toolkit:ListPickerItem Content="{Binding Path=LocalizedResources.measure_meters, Source={StaticResource LocalizedStrings}}"/>
</toolkit:ListPicker>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多