Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public static MauiApp CreateMauiApp()
.UseMauiCommunityToolkit(static options =>
{
options.SetShouldEnableSnackbarOnWindows(true);

options.Defaults.Popup.SetCanBeDismissedByTappingOutsideOfPopup(false);
})
#else
.UseMauiCommunityToolkit(static options =>
Expand Down
28 changes: 28 additions & 0 deletions src/CommunityToolkit.Maui/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ internal Options(in MauiAppBuilder builder) : this()
internal static bool ShouldSuppressExceptionsInBehaviors { get; private set; }
internal static bool ShouldEnableSnackbarOnWindows { get; private set; }

/// <summary>
///
/// </summary>
public Default Defaults { get; } = new Default();

/// <summary>
///
/// </summary>
public class Default
{
/// <summary>
///
/// </summary>
public PopupDefault Popup { get; } = new();

/// <summary>
///
/// </summary>
public class PopupDefault
{
/// <summary>
///
/// </summary>
/// <param name="canBeDismissedByTappingOutsideOfPopup"></param>
public void SetCanBeDismissedByTappingOutsideOfPopup(bool canBeDismissedByTappingOutsideOfPopup) => PopupDefaults.CanBeDismissedByTappingOutsideOfPopup = canBeDismissedByTappingOutsideOfPopup;
}
}

/// <summary>
/// Will return the <see cref="ICommunityToolkitValueConverter.DefaultConvertReturnValue"/> default value instead of throwing an exception when using <see cref="BaseConverter{TFrom,TTo}"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ static class PopupDefaults
/// Default value for <see cref="VisualElement.BackgroundColor"/> BackgroundColor
/// </summary>
public static Color BackgroundColor { get; } = Colors.White;

public static bool CanBeDismissedByTappingOutsideOfPopup { get; internal set; } =
PopupDefaults.CanBeDismissedByTappingOutsideOfPopup;
}
Loading