Skip to content

Commit 8682db5

Browse files
Merge pull request #113 from syncfusion/CollapseOnOverlayTap
Provide CollapseOnOverlayTap support for Maui Bottom Sheet
2 parents ff22988 + 0e8c1be commit 8682db5

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

maui/src/BottomSheet/SfBottomSheet.cs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,20 @@ public partial class SfBottomSheet : SfView, IParentThemeElement
455455
BindingMode.Default,
456456
propertyChanged: OnGrabberCornerRadiusPropertyChanged);
457457

458+
/// <summary>
459+
/// Identifies the <see cref="CollapseOnOverlayTap"/> bindable property.
460+
/// </summary>
461+
/// <value>
462+
/// The identifier for <see cref="CollapseOnOverlayTap"/> bindable property.
463+
/// </value>
464+
public static readonly BindableProperty CollapseOnOverlayTapProperty = BindableProperty.Create(
465+
nameof(CollapseOnOverlayTap),
466+
typeof(bool),
467+
typeof(SfBottomSheet),
468+
false,
469+
BindingMode.Default
470+
);
471+
458472
#endregion
459473

460474
#region Internal Bindable Properties
@@ -781,6 +795,18 @@ public CornerRadius GrabberCornerRadius
781795
set => SetValue(GrabberCornerRadiusProperty, value);
782796
}
783797

798+
/// <summary>
799+
/// Gets or sets whether the bottom sheet should collapse to its minimum height instead of closing when tapping outside.
800+
/// </summary>
801+
/// <value>
802+
/// It accepts Boolean values, and the default value is <c>false</c>.
803+
/// </value>
804+
public bool CollapseOnOverlayTap
805+
{
806+
get => (bool)GetValue(CollapseOnOverlayTapProperty);
807+
set => SetValue(CollapseOnOverlayTapProperty, value);
808+
}
809+
784810
#endregion
785811

786812
#region Internal Properties
@@ -1200,7 +1226,14 @@ void OnOverlayGridTapped(object? sender, EventArgs e)
12001226
{
12011227
if (_isSheetOpen)
12021228
{
1203-
Close();
1229+
if(CollapseOnOverlayTap)
1230+
{
1231+
State = BottomSheetState.Collapsed;
1232+
}
1233+
else
1234+
{
1235+
Close();
1236+
}
12041237
}
12051238
}
12061239

@@ -1815,6 +1848,7 @@ bool ShouldRestrictMovement(double newTranslationY, double diffY)
18151848
return false;
18161849
}
18171850

1851+
18181852
double endPosition = 0;
18191853
double updatedHeight = Height - newTranslationY;
18201854
switch (State)

maui/src/Charts/Series/CartesianSeries.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ internal bool IsGrouped
5454

5555
internal bool RequiredEmptyPointReset { get; set; } = false;
5656

57-
internal virtual bool IsFillEmptyPoint { get { return true; } }
58-
5957
#endregion
6058

6159
#region Bindable properties

maui/tests/Syncfusion.Maui.Toolkit.UnitTest/Navigation/SfBottomSheetUnitTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,18 @@ public void CollapsedHeight(double input, double expected)
450450
Assert.Equal(expected, actual);
451451
}
452452

453+
[Theory]
454+
[InlineData(true, true)]
455+
[InlineData(false, false)]
456+
public void CollapseOnOverlayTap(bool input, bool expected)
457+
{
458+
_bottomSheet.CollapseOnOverlayTap = input;
459+
460+
var actual = _bottomSheet.CollapseOnOverlayTap;
461+
462+
Assert.Equal(expected, actual);
463+
}
464+
453465
#endregion
454466

455467
#region Internal Properties

0 commit comments

Comments
 (0)