Forum Xamarin.Forms

Getting Exception : Xamarin.Forms.Xaml.XamlParseException: Cannot assign property "Text"

Vai1212Vai1212 Member ✭✭
edited March 2018 in Xamarin.Forms

Hi All,

I am Working on Multilingual functionality while i am binding my label with the Key , It is trowing Exception.
Please help Me.

            <RowDefinition Height="100" />
            <RowDefinition Height="120" />
            <RowDefinition Height="200" />
            <RowDefinition Height="77" />
            <ColumnDefinition Width="30" />
            <ColumnDefinition Width="280" />
            <ColumnDefinition Width="50" />
        <StackLayout Grid.Row="1" Orientation="Vertical" Grid.Column="1">

            <Label Text="{translator:Translate OneApp}" TextColor="#FEFEFE" Font="15" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center"></Label>



  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Nothing to help with. You need to show us your markup pertaining to the Label throwing the error.

  • Vai1212Vai1212 Member ✭✭
    edited March 2018



    public class TranslateExtension : IMarkupExtension
    const string ResourceId = "xxx.Resources.AppResources";
    static readonly Lazy resmgr = new Lazy(() => new ResourceManager(ResourceId, typeof(TranslateExtension).GetTypeInfo().Assembly));
    public string Text = "";

        public object ProvideValue(IServiceProvider serviceProvider)
            if (Text == "")
                return "";
            var ci = CrossMultilingual.Current.CurrentCultureInfo;
            var translation = resmgr.Value.GetString(Text, ci);
            if (translation == null)

    if DEBUG

                throw new ArgumentException(
                    String.Format("Key '{0}' was not found in resources '{1}' for culture '{2}'.", Text, ResourceId, ci.Name),


                translation = Text; // returns the key, which GETS DISPLAYED TO THE USER


            return translation;

    I am working of Current version of VS 2017
    and i Choosed .Net Standard

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Please edit your post and fix the markdown around the code so the site parser doesn't eat it. Its impossible to follow the way it is.

  • Vai1212Vai1212 Member ✭✭

    I have updated my Question. PLease have look and let me know

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    You named your property Text? That's a really bad choice in names because its already a keyword.
    That would be like naming a property Page or int or Label

    Go back and apply to good naming conventions to your code and see if that UNconfuses the compiler. Its probably getting lost in which Text you're referring to.

    Please also fix your second post - I'm sure you can see how bad the formatting of the code is.

Sign In or Register to comment.