This is a migrated thread and some comments may be shown as answers.

RadListPicker - windows phone 7.1 - call function

3 Answers 9 Views
ListPicker
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tomasz
Top achievements
Rank 1
Tomasz asked on 12 Apr 2016, 09:42 AM
<TextBlock Text="{Binding Path=Resx.My_name, Source={StaticResource Resources}}" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="{StaticResource PhoneHorizontalMargin}"/>
         <telerikInput:RadListPicker x:Name="myVariable" Grid.Column="0" Grid.Row="3" Margin="{StaticResource PhoneHorizontalMargin}" VerticalAlignment="Top" SelectionMode="Single">
                  <telerikInput:RadListPicker.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <TextBlock TextWrapping="Wrap" Text="{Binding Name123}" />
                                    </StackPanel>
                                </DataTemplate>
                   </telerikInput:RadListPicker.ItemTemplate>
          </telerikInput:RadListPicker>

 

RadListPicker:

* English

* French

* German

 

 How do I call a function when you select one language from the RadListPicker?

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 14 Apr 2016, 06:14 AM
Hi Tomasz,

The RadListPicker component exposes events that are triggered when a user clicks on an item. These events are described in our Events article. Please refer to is and let us know if you have any further questions.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tomasz
Top achievements
Rank 1
answered on 14 Apr 2016, 06:52 AM

@Pavel R. Pavlov Thank you, SelectionChanged is great,I use SelectionChanged="radListPicker_LanguageChanged"

I have little problem with culture set:

ManiPage.xaml.cs:

private void radListPicker_LanguageChanged(object sender, SelectionChangedEventArgs e)
{      
            var cultureInfo = System.Globalization.CultureInfo.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = cultureInfo;
            Thread.CurrentThread.CurrentUICulture = cultureInfo;
}

 

App.xaml.cs:

public App()

{

    var cultureInfoCurrent = System.Globalization.CultureInfo.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = cultureInfoCurrent;
            Thread.CurrentThread.CurrentUICulture = cultureInfoCurrent;

}

but when I choose option form RadListPicker language im menu is not change:

Text="{Binding Path=Resx.My_name, Source={StaticResource Resources}}"

in Resourse I have two files:

Resources.resx

Resources.en-US.resx

 

0
Pavel R. Pavlov
Telerik team
answered on 18 Apr 2016, 06:41 AM
Hello Tomasz,

If you are executing the provided snippets I would say that the reported behavior is expected. I can see that you initialize the culture of your application in the constructor of your application which is OK. On the other hand, I can see that you are setting the culture of your application to the very same value in the Selection Changed event handler. Which is expected to NOT change the referenced string.

In other words both cultures used in your snippets are equal (if there is no explicit change on your system) and this may be the reason behind the reported behavior. If you need to change the culture of your application in the SelectionChanged event handler you will first need to check which language the user had selected. This can be done by taking  a look of the arguments of the SelectionChanged event. After that you will need to actually change the culture.

Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-BR");
For more information you can take a look at the MSDN documentation.

Regards,
Pavel R. Pavlov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListPicker
Asked by
Tomasz
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Tomasz
Top achievements
Rank 1
Share this question
or