I have a WP7 application displaying 3 thumbnails at the bottom and a big one at the center of the screen. Upon clicking on each thumbnail, a method in the xaml.cs file is triggered replacing the source of the big image to display an enlarged version of the thumbnail.
Now, I added a textbox at the bottom of the big image that would display text describing each image. Such text is stored as separate strings in a RESX file for each locale (en, fr).
In the existing 3 methods that update the big image upon clicking on each of the 3 thumbnails, I want to add a line to also update the text of the textbox, displaying the correct string for the current locale of Windows Phone 7.
private void thumb1_Click(object sender, RoutedEventArgs e)
{
Uri uri = new Uri("/myApp;component/Images/Dialog%20-%20Blocked%20Sites.png", UriKind.Relative);
ImageSource newSource = new System.Windows.Media.Imaging.BitmapImage(uri);
imgTarget.Source = newSource;
imgDesc.Text = "placeholderDesc1";
}
I know how to use binding to display localized text from the resx files in the XAML but I don't know the syntax in the xaml.cs code file. Could you please assist?
<TextBlock Height="67" Name="appDesc" Style="{StaticResource PhoneTextTitle1Style}" Text="{Binding Path=LocalizedResources.appDesc, Source={StaticResource LocalizedStrings}}" FontSize="22" TextWrapping="Wrap" />
Many thanks.
Try
AppResources.appDesc
Nothing more