public event OnSlideEventHandler OnSlideEvent = delegate { };
private double _lastHeight = 0.0;
+ private double _maxOpenedHeight = 0.0;
public RejectCallPanel()
{
}
/// <summary>
- /// Max height of panel
+ /// The max height of panel in the opened state
/// </summary>
- public static readonly BindableProperty MaxHeightProperty = BindableProperty.Create(
- "MaxHeight",
+ public static readonly BindableProperty MaxOpenedHeightProperty = BindableProperty.Create(
+ "MaxOpenedHeight",
typeof(double),
typeof(RejectCallPanel),
- 150.0);
+ 0.0);
- public double MaxHeight
+ public double MaxOpenedHeight
{
get
{
- return (double)GetValue(MaxHeightProperty);
+ return (double)GetValue(MaxOpenedHeightProperty);
}
set
{
- SetValue(MaxHeightProperty, value);
+ SetValue(MaxOpenedHeightProperty, value);
}
}
{
case GestureStatus.Started:
_lastHeight = Height;
+ double contentHeight = Content.Height + Height;
+
+ if (MaxOpenedHeight.Equals(0.0) || MaxOpenedHeight > contentHeight)
+ {
+ _maxOpenedHeight = contentHeight;
+ }
+ else
+ {
+ _maxOpenedHeight = MaxOpenedHeight;
+ }
+
break;
case GestureStatus.Running:
{
double panelHeight = GetNewHeight(e.TotalY);
- if (panelHeight > DefaultHeight && panelHeight < MaxHeight)
+ if (panelHeight > DefaultHeight && panelHeight < _maxOpenedHeight)
{
HeightRequest = panelHeight;
}
case GestureStatus.Completed:
{
double panelHeight = Height;
- double halfMaxHeight = MaxHeight / 2;
+ double halfMaxHeight = _maxOpenedHeight / 2;
if (panelHeight >= halfMaxHeight)
{
IsOpen = true;
- HeightRequest = MaxHeight;
+ HeightRequest = _maxOpenedHeight;
}
else
{