RadListPicker - windows phone 7.1 - call function

4 posts, 0 answers
  1. Tomasz
    Tomasz avatar
    2 posts
    Member since:
    Apr 2016

    Posted 12 Apr Link to this post

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

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 14 Apr Link to this post

    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
  3. DevCraft banner
  4. Tomasz
    Tomasz avatar
    2 posts
    Member since:
    Apr 2016

    Posted 14 Apr Link to this post

    @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

     

  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 18 Apr Link to this post

    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
Back to Top
DevCraft banner