I have a problem with localizations UserControlin my Windows Phone 8 app on XAML and C #. Unfortunately, I did not find a useful solution to my problem, despite the fact that I tried to fix it all the weekend.
Problem:
I have a custom UserControlone that I use in MainPage.xaml. I tried to bind the localized string to IngredientName, but I get:
System.Windows.Markup.XamlParseException (Failed to assign property)
This is MyUserControl.xaml :
<UserControl x:Name="myuc">
<TextBlock x:Name="txt_IngredientName />
</UserControl>
In the code behind ( MyUserControl.xaml.cs ), I use the following lines to set and retrieve values ββin MainPage:
public string IngredientName
{
get { return this.txt_ingredientName.Text; }
set { this.txt_ingredientName.Text = value; }
}
In MainPage.xaml, I call UserControl as follows:
<local:MyUserControl IngredientName="Chocolate"/>
. :
IngredientName="{Binding Path=LocalizedResources.Chocolate, Source={StaticResource LocalizedStrings}}"
.
, .., . - , UserControl? - ?