0
votes

I am trying to use the listpicker control in my windows phone 7 app, I have the xaml set up correctly, but I want to use strings from my resource file instead of the literals (for Yards and Meters) that I currently have set up:

    <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>

I have tried the following:

    <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>

but it is not binding to the resource strings. I know that I could create a Data Template, and Bind that way, but I am looking for a simpler solution, any ideas?

1
Have you looked at why "it is not binding to the resource strings"?Matt Lacey
I googled this pretty thoroughly, and searched extensively on SO. It seems like no one is really localizing their win phone apps. It just seems like there should be a simple solution to this though.javram

1 Answers

0
votes

Try the following:

<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>