Can I know how do you get the stations data ? there might be a better solutions than what you're doing.
If you don't want to start you code over
Here is a solution
Add a new class name it LanguageConverter.cs
don't forget to replace "YourNamespace" with the one in your app
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace YourNamespace
{
public class LanguageConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var station = value as Station;
return System.Globalization.CultureInfo.CurrentCulture.Name.Contains("ar") ? station.NameArabic : station.NameEnglish;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value;
}
}
}
in the xaml where your adding the list
add a to the page or a parent control (in my example I put it in the Grid which is my LayoutRoot )
Code:
<Grid.Resources>
<local:LanguageConverter x:Name="LanguageConverter" />
</Grid.Resources>
then in your datatemplate
Code:
<DataTemplate x:Name="PickerItemTemplate">
<Grid>
<TextBlock FontFamily="Segoe WP Light" Text="{Binding, Converter={StaticResource LanguageConverter}}"
FontSize="26" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,0,0,2" />
</Grid>
</DataTemplate>
try this a give me a feedback.
PS: didn't try it