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

Trouble binding Constraint to View

$
0
0

Hello, I'm trying to bind a Constraint from my view to my view model so I can update it depending on the presence of an extended status bar (Turns out regular pages adjust to extended status bars just fine but modal pages do not). In my xaml I have..

    <StackLayout RelativeLayout.YConstraint= "{Binding ModalPageY}" >

In the code behind I have...

    this.BindingContext = new IPSelectorViewModel();

and in the ViewModel I have...

    public class IPSelectorViewModel : INotifyPropertyChanged
    {

            public event PropertyChangedEventHandler PropertyChanged;

            public IPSelectorViewModel()
            {
                    ModalPageY = Constraint.Constant(20);
            }

            private Constraint modalPageY;
            public Constraint ModalPageY
            {
                    get 
                    {
                            return modalPageY;
                    }
                    set 
                    {
                            modalPageY = value;
                            PropertyChanged (this, new PropertyChangedEventArgs ("ModalPageY"));
                    }
            }
    }

The problem is the page renders as if the ModalPageY Constraint was set to Constraint.Constant(0). Any idea whats going on? I know the getter and setters are getting hit when I go to the page. Any help would be appreciated. Thanks!


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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