diff --git a/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs b/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs
index a4485891a..b9689f675 100644
--- a/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs
+++ b/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs
@@ -1,3 +1,4 @@
+using System.ComponentModel;
using CommunityToolkit.Maui.Extensions;
namespace CommunityToolkit.Maui.Views;
@@ -8,29 +9,40 @@ namespace CommunityToolkit.Maui.Views;
public partial class Popup : ContentView
{
///
- /// Bindable property to set the margin between the and the edge of the window
+ /// Gets or sets the margin between the and the edge of the window.
///
- public static new readonly BindableProperty MarginProperty = View.MarginProperty;
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateDefaultMargin))]
+ public partial Thickness Margin { get; set; }
+ static object CreateDefaultMargin(global::Microsoft.Maui.Controls.BindableObject? _) => Options.DefaultPopupSettings.Margin;
///
- /// Bindable property to set the padding between the border and the content
+ /// Gets or sets the padding between the border and the content.
///
- public static new readonly BindableProperty PaddingProperty = ContentView.PaddingProperty;
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateDefaultPadding))]
+ public partial Thickness Padding { get; set; }
+ static object CreateDefaultPadding(global::Microsoft.Maui.Controls.BindableObject? _) => Options.DefaultPopupSettings.Padding;
///
- /// Bindable property to set the horizontal position of the when displayed on screen
+ /// Gets or sets the horizontal layout options used to position the when displayed on screen.
///
- public static new readonly BindableProperty HorizontalOptionsProperty = View.HorizontalOptionsProperty;
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateDefaultHorizontalOptions))]
+ public partial LayoutOptions HorizontalOptions { get; set; }
+ static object CreateDefaultHorizontalOptions(global::Microsoft.Maui.Controls.BindableObject? _) => Options.DefaultPopupSettings.HorizontalOptions;
///
- /// Bindable property to set the vertical position of the when displayed on screen
+ /// Gets or sets the vertical layout options used to position the when displayed on screen.
///
- public static new readonly BindableProperty VerticalOptionsProperty = View.VerticalOptionsProperty;
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateDefaultVerticalOptions))]
+ public partial LayoutOptions VerticalOptions { get; set; }
+ static object CreateDefaultVerticalOptions(global::Microsoft.Maui.Controls.BindableObject? _) => Options.DefaultPopupSettings.VerticalOptions;
///
- /// Backing BindableProperty for the property.
+ /// Gets or sets a value indicating whether the can be dismissed by tapping outside of the popup.
///
- public static readonly BindableProperty CanBeDismissedByTappingOutsideOfPopupProperty = BindableProperty.Create(nameof(CanBeDismissedByTappingOutsideOfPopup), typeof(bool), typeof(Popup), Options.DefaultPopupSettings.CanBeDismissedByTappingOutsideOfPopup);
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateCanBeDismissedByTappingOutsideOfPopup))]
+ public partial bool CanBeDismissedByTappingOutsideOfPopup { get; set; }
+ static object CreateCanBeDismissedByTappingOutsideOfPopup(global::Microsoft.Maui.Controls.BindableObject? _) => Options.DefaultPopupSettings.CanBeDismissedByTappingOutsideOfPopup;
+
///
/// Initializes Popup
@@ -54,53 +66,6 @@ public Popup()
///
public event EventHandler? Closed;
- ///
- /// Sets the margin between the and the edge of the window
- ///
- public new Thickness Margin
- {
- get => base.Margin;
- set => base.Margin = value;
- }
-
- ///
- /// Sets the padding between the border and the content
- ///
- public new Thickness Padding
- {
- get => base.Padding;
- set => base.Padding = value;
- }
-
- ///
- /// Sets the horizontal position of the when displayed on screen
- ///
- public new LayoutOptions HorizontalOptions
- {
- get => base.HorizontalOptions;
- set => base.HorizontalOptions = value;
- }
-
- ///
- /// Sets the vertical position of the when displayed on screen
- ///
- public new LayoutOptions VerticalOptions
- {
- get => base.VerticalOptions;
- set => base.VerticalOptions = value;
- }
-
- /// />
- ///
- /// When true and the user taps outside the popup, it will dismiss.
- /// On Android - when false the hardware back button is disabled.
- ///
- public bool CanBeDismissedByTappingOutsideOfPopup
- {
- get => (bool)GetValue(CanBeDismissedByTappingOutsideOfPopupProperty);
- set => SetValue(CanBeDismissedByTappingOutsideOfPopupProperty, value);
- }
-
///
/// Close the Popup.
///
diff --git a/src/CommunityToolkit.Maui/Views/Popup/PopupOptions.shared.cs b/src/CommunityToolkit.Maui/Views/Popup/PopupOptions.shared.cs
index 285bf517f..4016c575b 100644
--- a/src/CommunityToolkit.Maui/Views/Popup/PopupOptions.shared.cs
+++ b/src/CommunityToolkit.Maui/Views/Popup/PopupOptions.shared.cs
@@ -8,71 +8,47 @@ namespace CommunityToolkit.Maui;
public partial class PopupOptions : BindableObject, IPopupOptions
{
///
- /// Backing BindableProperty for the property.
+ /// Gets or sets a value indicating whether the popup can be dismissed by tapping outside of the popup.
+ /// Default is provided by .
///
- public static readonly BindableProperty CanBeDismissedByTappingOutsideOfPopupProperty = BindableProperty.Create(nameof(CanBeDismissedByTappingOutsideOfPopup), typeof(bool), typeof(PopupOptions), Options.DefaultPopupOptionsSettings.CanBeDismissedByTappingOutsideOfPopup);
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateCanBeDismissedByTappingOutsideOfPopup))]
+ public partial bool CanBeDismissedByTappingOutsideOfPopup { get; set; }
+ static object CreateCanBeDismissedByTappingOutsideOfPopup(BindableObject? _) => Options.DefaultPopupOptionsSettings.CanBeDismissedByTappingOutsideOfPopup;
///
- /// Backing BindableProperty for the property.
+ /// Gets or sets an invoked when the user taps outside of the popup.
+ /// Default is provided by .
///
- public static readonly BindableProperty OnTappingOutsideOfPopupProperty = BindableProperty.Create(nameof(OnTappingOutsideOfPopup), typeof(Action), typeof(PopupOptions), Options.DefaultPopupOptionsSettings.OnTappingOutsideOfPopup);
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateOnTappingOutsideOfPopup))]
+ public partial Action? OnTappingOutsideOfPopup { get; set; }
+ static object? CreateOnTappingOutsideOfPopup(BindableObject? _) => Options.DefaultPopupOptionsSettings.OnTappingOutsideOfPopup;
///
- /// Backing BindableProperty for the property.
+ /// Gets or sets the overlay applied to the page while the popup is displayed.
+ /// Default is provided by .
///
- public static readonly BindableProperty PageOverlayColorProperty = BindableProperty.Create(nameof(PageOverlayColor), typeof(Color), typeof(PopupOptions), Options.DefaultPopupOptionsSettings.PageOverlayColor);
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreatePageOverlayColor))]
+ public partial Color PageOverlayColor { get; set; }
+ static object CreatePageOverlayColor(BindableObject? _) => Options.DefaultPopupOptionsSettings.PageOverlayColor;
///
- /// Backing BindableProperty for the property.
+ /// Gets or sets the used to render the popup's outline.
+ /// Default is provided by .
///
- public static readonly BindableProperty ShapeProperty = BindableProperty.Create(nameof(Shape), typeof(Shape), typeof(PopupOptions), Options.DefaultPopupOptionsSettings.Shape);
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateShape))]
+ public partial Shape? Shape { get; set; }
+ static object? CreateShape(BindableObject? _) => Options.DefaultPopupOptionsSettings.Shape;
///
- /// Backing BindableProperty for the property.
+ /// Gets or sets the applied to the popup.
+ /// Default is provided by .
///
- public static readonly BindableProperty ShadowProperty = BindableProperty.Create(nameof(Shadow), typeof(Shadow), typeof(PopupOptions), Options.DefaultPopupOptionsSettings.Shadow);
+ [BindableProperty(DefaultValueCreatorMethodName = nameof(CreateShadow))]
+ public partial Shadow? Shadow { get; set; }
+ static object? CreateShadow(BindableObject? _) => Options.DefaultPopupOptionsSettings.Shadow;
///
/// An empty instance of containing default values.
///
public static IPopupOptions Empty { get; } = new PopupOptions();
-
- ///
- ///
- /// When true and the user taps outside the popup, it will dismiss.
- /// On Android - when false the hardware back button is disabled.
- ///
- public bool CanBeDismissedByTappingOutsideOfPopup
- {
- get => (bool)GetValue(CanBeDismissedByTappingOutsideOfPopupProperty);
- set => SetValue(CanBeDismissedByTappingOutsideOfPopupProperty, value);
- }
-
- ///
- public Color PageOverlayColor
- {
- get => (Color)GetValue(PageOverlayColorProperty);
- set => SetValue(PageOverlayColorProperty, value);
- }
-
- ///
- public Action? OnTappingOutsideOfPopup
- {
- get => (Action?)GetValue(OnTappingOutsideOfPopupProperty);
- set => SetValue(OnTappingOutsideOfPopupProperty, value);
- }
-
- ///
- public Shape? Shape
- {
- get => (Shape?)GetValue(ShapeProperty);
- set => SetValue(ShapeProperty, value);
- }
-
- ///
- public Shadow? Shadow
- {
- get => (Shadow?)GetValue(ShadowProperty);
- set => SetValue(ShadowProperty, value);
- }
}
\ No newline at end of file