Reputation: 165
I am using mechanism to move Stacklayout with gestures. Is there another event that detects StackLayout's Y position change? Meaning that I would like to catch when the StackLayout position is being panned up or down.
<StackLayout x:Name="bottomDrawer" BackgroundColor="Olive" AbsoluteLayout.LayoutBounds="0.5,1.00,0.9,0.04" AbsoluteLayout.LayoutFlags="All">
<StackLayout.GestureRecognizers>
<PanGestureRecognizer PanUpdated="PanGestureHandler" />
</StackLayout.GestureRecognizers>
</StackLayout>
Upvotes: 1
Views: 208
Reputation: 74209
There are PropertyChanging
and PropertyChanged
events on the BindableObject
(which is a class within the StackLayout
hierarchy).
So you could bind to change(s) on the Y
, Height
and/or LayoutBounds
properties.
Example using events:
aStackLayoutObject.PropertyChanging += (sender, e) =>
{
switch (e.PropertyName)
{
case "Y":
Log.WriteLine($"{e.PropertyName} : {(sender as StackLayout).Y}");
break;
case "Height":
Log.WriteLine($"{e.PropertyName} : {(sender as StackLayout).Height}");
break;
case "LayoutBounds":
Log.WriteLine($"{e.PropertyName}";
break;
};
aStackLayoutObject.PropertyChanged += (sender, e) =>
{
switch (e.PropertyName)
{
case "Y":
Log.WriteLine($"{e.PropertyName} : {(sender as StackLayout).Y}");
break;
case "Height":
Log.WriteLine($"{e.PropertyName} : {(sender as StackLayout).Height}");
break;
case "LayoutBounds":
Log.WriteLine($"{e.PropertyName}";
break;
};
Upvotes: 1