Bug 44216 - No property, bindable property, or event found when using xamlc
Summary: No property, bindable property, or event found when 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-06-13 14:50 UTC (History)
5 users (show)

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


Attachments
No property or bindable property not found for FontSize when enable XamlC compilation (270.47 KB, application/x-zip-compressed)
2017-06-13 12:04 UTC, Magesh Kumar
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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
Comment 3 Magesh Kumar 2017-06-13 12:04:05 UTC
Created attachment 22853 [details]
No property or bindable property not found for FontSize when enable XamlC compilation
Comment 4 Magesh Kumar 2017-06-13 12:07:51 UTC
This issue still exists in 2.3.5.233-pre1 version. Attached a sample (FontSizeSample) which replicates issue. 

Attached in previous update.
Comment 5 Stephane Delcroix 2017-06-13 14:10:54 UTC
@Magesh: the message you're reporting is unrelated to this issue.

You're complaining that this syntax

    <Font FontSize="20"/>

throws

    ./FontSizeSample/Page1.xaml(13,13): Error: Position 8:13. No property, bindable property, or event found for 'FontSize', or mismatching type between value and property. (FontSizeSample)

which is totally to be expected, as Font.FontSize doesn't define any public setter. The message could be slightly more clear if it was saying "No accessible property setter, ..." But I'm quite sure you get the idea without the more verbose language.
Comment 6 FieldstrikeMobile 2017-06-13 14:15:24 UTC
I was sent here by Syncfusion because their documentation states to use it like so:  https://help.syncfusion.com/xamarin/sfchart/datamarker#customizing-labels

<chart:DataMarkerLabelStyle TextColor="Blue" BorderColor="Red" BorderThickness="2" BackgroundColor="Aqua" Angle="315" Margin="5">
	<chart:DataMarkerLabelStyle.Font>
              <Font FontSize="18" FontAttributes="Italic"/>
	</chart:DataMarkerLabelStyle.Font>
</chart:DataMarkerLabelStyle>

perhaps the way they are advising customers to set Font is incorrect?
Comment 7 Stephane Delcroix 2017-06-13 14:37:26 UTC
> perhaps the way they are advising customers to set Font is incorrect?

Bigly
Comment 8 FieldstrikeMobile 2017-06-13 14:38:55 UTC
How would you advise setting the font in the case above?

I had to extend DataMarkerLabelStyle and Set the font in code. Felt messy
Comment 9 Stephane Delcroix 2017-06-13 14:48:32 UTC
I'd do

    <chart:DataMarkerLabelStyle Font="Italic,42" />
Comment 10 Stephane Delcroix 2017-06-13 14:49:41 UTC
see https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/FontTypeConverter.cs#L12 for references on how to use the Font Type Converter
Comment 11 FieldstrikeMobile 2017-06-13 14:50:44 UTC
Brilliant! thanks