Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Constraint Expression Via MVVM Binding

$
0
0

Hi,

I tried the following and it had no effect (and no errors, nothing happened even though the breakpoint in the ViewModel was hit)...

In XAML:

<Button
RelativeLayout.WidthConstraint=
                 "{Binding MenuBackgroundYConstraint}" />

In ViewModel:

    public Xamarin.Forms.ConstraintExpression MenuBackgroundYConstraint
    {
        get
        {
            var exp=new Xamarin.Forms.ConstraintExpression();
            exp.Type = Xamarin.Forms.ConstraintType.RelativeToParent;
            exp.Property = "Height";
            exp.Factor = .5;


            return exp;
        }

    }

Did I miss something or does this just not work?


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>