No property, bindable property, or event found for 'YConstraint' after update to Forms 2.3.3.168

Hello, I have a annoying problem after the update from Xamarin.Forms 2.3.2 to 2.3.3. I'm not able to build my project anymore. The build stops on usage of the MarkupExtension -> RelativeToViewVertical on XAML Pages with a XML Error: "No property, bindable property, or event found for 'YConstraint'"

Xaml Usage:
.. xmlns:support="clr-namespace:MyApp.Layout;assembly=MyApp" .. <RelativeLayout> <Label FontSize="13" Text="{Binding DetailText}" RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=50}" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Constant=-142}" RelativeLayout.HeightConstraint="{ConstraintExpression Type=Constant, Constant=60}" /> <Button Text="test" BackgroundColor="Transparent" BorderColor="Transparent" FontSize="14" Command="{Binding ForgotPassword}" RelativeLayout.YConstraint="{support:RelativeToViewVertical ElementName=ElementBefore, Constant=105}" <!-- crashes here --> RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Constant=-170}" />

With that kind Extension: https://github.com/Mike-EEE/xamarin-forms-samples/blob/master/FormsGallery/FormsGallery/FormsGallery/Support/RelativeToViewHorizontal.cs

The error appears since Forms 2.3.3-pre1 (2.3.2.127 works fine). When I setup a new Project with Forms 2.3.3 and the RelativeToViewVertical code it works. Any ideas?

Best Answer

Answers

  • rmarinhormarinho PTMember, Insider, Beta Xamurai

    Do you get the error without the Extension ?

  • TimoGalongaTimoGalonga DEMember ✭✭

    If I remove all the "{support:RelativeToView..." usages from the xaml code the app builds and works beside the now appearing layoutproblems.

  • rmarinhormarinho PTMember, Insider, Beta Xamurai

    Maybe that library needs to be updated ?

  • TimoGalongaTimoGalonga DEMember ✭✭

    hm.. which library do you mean? The RelativeToView logic is just in code .. and the same code works on a new xam.forms 2.3.3 project.

  • rmarinhormarinho PTMember, Insider, Beta Xamurai

    Oh sorry i was thinking RelativeToView was code on other library. Are you sure all projects have the same nuget version ?

    Also just to make sure nuke obj and bin folders to see if is some files that aren't being rebuild.

  • TimoGalongaTimoGalonga DEMember ✭✭
    edited November 2016

    @StephaneDelcroix thanks - that helps. Implementing IMarkupExtension<Constraint> solve my problem :blush:

  • JoeMankeJoeManke USMember ✭✭✭✭✭
    edited February 2017

    I'm having the same problem after updating from 2.3.2.127 to 2.3.3.180. The solution of implementing IMarkupExtension<T> unfortunately doesn't work, because my extension already does so. If I turn off XamlC the code still works.

    Repro project is attached.

    EDIT: Oddly enough, changing my implementation to not be generic seems to work.

  • TimoGalongaTimoGalonga DEMember ✭✭
    edited February 2017

    Implementation looks like that:

    object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) { return (this as IMarkupExtension<Constraint>)?.ProvideValue(serviceProvider); }

Sign In or Register to comment.