This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 44216 - No property, bindable property, or event found Wen using xamlc
Summary: No property, bindable property, or event found Wen using xamlc
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-09-12 19:07 UTC by nicollas braga
Modified: 2017-02-02 14:35 UTC (History)
3 users (show)

See Also:
Tags: ac
Is this bug a regression?: ---
Last known good build:


Attachments

Description nicollas braga 2016-09-12 19:07:10 UTC
I've create an Behavior, its compile and run without any problem when using the default xaml

but wen you try to use the xamlc ([assembly: XamlCompilation(XamlCompilationOptions.Compile)]) 

its don't compile with error Position 13:72. No property, bindable property, or event found for 'MinLengh'



<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="AppName.Views.SignUpPage"
             xmlns:Controls="clr-AppGlobals.AddOn.Behaviors;assembly=VogoApp"
             Title="Cadastro">
  <ContentPage.Content>
    <ScrollView>
      <StackLayout VerticalOptions="CenterAndExpand" Padding="5,0,0,5">
        <Label Text="Cdade" />
        <Entry x:Name="cidade" Placeholder="Cidade - UF" >
          <Entry.Behaviors>
            <Controls:RequiredBehavior x:Name="cidadeRequiredBehavior" MinLengh="5"/>
          </Entry.Behaviors>
        </Entry>










 public class RequiredBehavior : Behavior<Entry>
    {
        static readonly BindablePropertyKey IsValidPropertyKey = BindableProperty.CreateReadOnly("IsValid", typeof(bool), typeof(ComparisonBehavior), false);
        public static readonly BindableProperty IsValidProperty = IsValidPropertyKey.BindableProperty;
        
        static readonly BindableProperty MinLenghProperty = BindableProperty.Create("MinLengh", typeof(int), typeof(ComparisonBehavior), 1);
        static readonly BindableProperty MaxLenghProperty = BindableProperty.Create("MaxLengh", typeof(int), typeof(ComparisonBehavior), int.MaxValue);


        /// <summary>
        /// Get the value that determine if the value has validated
        /// </summary>
        public bool IsValid
        {
            get { return (bool)base.GetValue(IsValidProperty); }
            private set { base.SetValue(IsValidPropertyKey, value); }
        }

        /// <summary>
        /// Get or Set the min lengh 
        /// </summary>
        public int MinLengh
        {
            get { return (int)base.GetValue(MinLenghProperty); }
            private set { base.SetValue(MinLenghProperty, value > 0 ? value: 1); }
        }

        /// <summary>
        /// Get or Set the max lengh 
        /// </summary>
        public int MaxLengh
        {
            get { return (int)base.GetValue(MaxLenghProperty); }
            private set { base.SetValue(MaxLenghProperty, value > 0 ? value: 1); }
        }
Comment 1 Stephane Delcroix 2017-01-25 13:49:37 UTC
You're not going to like it, but XamlC is right in failing, and the normal parser should fail as well for the following reason:
 - the BindableProperty MinLengh is private,
 - the setter for the MinLengh property is private as well.

Here's the fix that will make it fail all the time https://github.com/xamarin/Xamarin.Forms/pull/717
Comment 2 Stephane Delcroix 2017-02-02 14:35:12 UTC
this will be fixed in 2.3.5-pre1

Note You need to log in before you can comment on or make changes to this bug.