-
Notifications
You must be signed in to change notification settings - Fork 441
Add PopupExtensions.ClosePopup()
#2671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TheCodeTraveler
merged 13 commits into
feature/sl/remove-popup-constraint-from-popup-service
from
Add-PopupExtensions.ClosePopup()
May 26, 2025
Merged
Add PopupExtensions.ClosePopup()
#2671
TheCodeTraveler
merged 13 commits into
feature/sl/remove-popup-constraint-from-popup-service
from
Add-PopupExtensions.ClosePopup()
May 26, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…into Add-PopupExtensions.ClosePopup()
PopupExtensions.Close()
PopupExtensions.ClosePopup()
This ensures we do not forget to remove the Obsolete Popup classes in our .NET 10 release
bijington
approved these changes
May 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The only possible extra question I have is: should we add an example to the sample app that covers this functionality? Or was it already there and we just missed it during testing?
Good call! Done. |
…/CommunityToolkit/Maui into Add-PopupExtensions.ClosePopup()
6915726
into
feature/sl/remove-popup-constraint-from-popup-service
2 checks passed
TheCodeTraveler
added a commit
that referenced
this pull request
May 26, 2025
* Initial musings on showing popups without having to create your own popup * Remove commented code * Pass on the BindingContext of a view up to the popup * Expand IPopupService API to enable the ability to supply the configurable properties The aim is to allow us to hide the Popup away from developers, or at least simply the usage of showing a popup to not needing to create a Popup implementation * Name the cancellation token usage * Include DynamicallyAccessedMembers * Popup V2 * Update samples * Fix tests * register all popups * fix tizen build * await tasks * fix xaml * Fix tests * Fix popup Result * Fix tests, fix samples, rework popup service * fix sample * Fix back button * Fix tests * Add Navigation parameter * Fix after rebase * Remove old page * Add docs * Use Partial Property * Disable `PushModalAsync` and `PopModalAsync` Animations * Remove Circular Reference to PopupContainer * Remove Null Forgiving Operator * Update Event Name * Add CancellationToken Parameter * Remove duplicate `()` * Add PopupExtension method for `Page` * Remove `return await` * Update formatting * Use `WeakEventManager` * Remvoe Duplicate `SemanticOrderViewPageViewModel` Mapping * Use Bindings to ensure `Popup.BindingContext` and `PopupContainer.BindingContext` always matches Popup.BindingContext * Remove `PopupLifecycleController`, Organize Folder Structure * Remove `BuildPopupContent()`, `BuildPopupContent` and `ConfigurePopupContainer ` from `PopupExtensions * Use correct `ShowPopup` method * Make PopupOptions Bindable, Fix Popup Samples, Add `PopupService.ShowPopup` * Propogate BindableProperties * `dotnet format` * Fix binding * Apply suggestions from code review Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Create `IPopupOptions`, Add `PopupOptions.Empty`, Fix File Naming, Namespaces + Folder Structure * Add `PopupOptionsDefaults` * Fix file names * `dotnet format` * Move to `CommunityToolkit.Maui` * Remove `ConvertToLayoutOptions` * Add PopupContainer Tests * Add PopupServiceTests * Add PopupTests * Remove `PopupAnchor` * Make `PopupOptions` properties readonly on `Popup` * Mark `PopupOptions` `BindableProperty`s as `[Obsolete]` * Update XML Comments, Add `Background` * Update XML Comments * Add XC0618 to `WarningsAsErrors` * Add Unit Tests * Remove duplicate GetPopupContainer() * Update PopupServiceTests.cs * Update Popup Tests * Add Popup Tests * Fix Popup_Close_ShouldNotThrowExceptionWhenCloseIsOverridden * Update Popup Tests * Update Popup.shared.cs * Update Popup.shared.cs * Add CancellationToken to PopupT.Close() * Add PopupExtensionsTests * Fix namespace * Add `PopupOptionsTests` * Add `IPopupOptionsTests` * Format + Remove unused code * Add `PopupContainer Tests` * Update Unit Tests * Rename to `bindablePopupOptions` * Add PopupOptions.BorderStroke * Rename `PopupOptions.BackgroundColor` -> `PopupOptions.PageOverlayColor` * Refactor Popup BackgroundColor * Fix Default Padding and Background Bindings * Remove duplicate BindingContext Binding * Add ShowPopupAsync_ShouldReturnResult_WhenPopupIsClosedByTappingOutsidePopup * Remove duplicate code * Update PopupResult.shared.cs * Update PopupResult.shared.cs * Ensure PopupResult<T> generic type is always nullable * Refactor `IsNullable()` * Implement `IPopupResult` * Update Popup Unit Tests * Remove XAML from CSharpBindingPopup * Add PopupOptionsDefaults.PopupBackgroundColor * Set default Shape + BorderColor * Add IPopupOptions.Shadow * Add Shadow, Update Unit Tests * Add `ArgumentNullException.ThrowIfNull(view);` * Update Sample Popups * Ensure PopupContainer.Close closes the correct popup * Add `popupContainersInModalStackList.Count` check * Refactor Close * Add IAsyncDisposable * Fix failing PopupTests * Fix PopupSizingIssuesPage * Update Popup Styling * Use `PopupOptions.Shape` for BorderStroke and StrokeThickness * `dotnet format` * Rename `PopupContainer` -> `PopupPage` * Update ServiceCollectionExtensions.shared.cs * Remove `CommunityToolkit.Maui.Extensions.NullableExtensions` * Rename to `PopupPage` * Update Sample Popups * Fix Default `StrokeThickness` * Refactor `DisplayPopup` * Add `string? shellRoute` * Add `string? shellRoute` parameter * Add `PopupOnDisappearingPage` * Refactor OnDisappearingPopupPage * Update PopupOnDisappearingPage.cs * Remove default parameters from `internal` methods * Flow Popup Properties through to PopupPageLayout.Content * Update src/CommunityToolkit.Maui/Extensions/PopupExtensions.shared.cs Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Unsubscribe event handler * Fix XML Comments * Add `ThrowIfCancellationRequested()` * Update XML Docs, Create InvalidPopupOperationException, Update Unit Tests * Add `AddTransientPopup()`, `AddSingletonPopup()` and `AddScopedPopup()` * Add Unit Tests * Add Unit Tests * Update Sample App Popups * Use Colors.LightGray for Default BorderStroke * Reduce Sample App Popup VerticalStackLayout Spacing to `6` * Reduce `BoxView` Margin * Fix Sample App Build Errors * Make default constructor internal * Add Support for Shell + `IQueryAttributable` for PopupV2 (#2661) * Re-add Handlers with `[Obsolete]` * Remove `Microsoft.NET.Test.Sdk` * `dotnet format` * Update PopupResultException * Update NuGet Packages * Fix formatting * Use `PopupDefaults.Padding` when Padding is not set * Add `HorizontalOptionsConverter` and `VerticalOptionsConverter` to ensure PopupDefaults are set * Remove `LayoutOptions.Fill` from `PopupLayoutAlignmentPage` * Add `ShowPopupAsync_WithViewType_SetsCorrectDefaults` * Add .NET 10 Compiler Error This ensures we do not forget to remove the Obsolete Popup classes in our .NET 10 release * Add `[EditorBrowsable(EditorBrowsableState.Never)]` to Obsolete classes * Add `PopupExtensions.ClosePopup()` (#2671) * Add `Close()` * Update PopupExtensions.shared.cs * Add CancellationToken * Add Unit Tests * Add Support for Shell * Add .NET 10 Compiler Error This ensures we do not forget to remove the Obsolete Popup classes in our .NET 10 release * Rename `Close()` -> `CloseAsync()` * Add `[EditorBrowsable(EditorBrowsableState.Never)]` to Obsolete classes * Update Samples * Fix XML * Use async/await * Rename to `CloseAsync` * Bump `TOOLKIT_NET_VERSION` to 9.0.300 * Update global.json * Add Page Overloads to IPopupService --------- Co-authored-by: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Co-authored-by: Vladislav Antonyuk <vladislav.antonyuk@dataart.com> Co-authored-by: Vladislav Antonyuk <vlad.antonyuk@gmail.com> Co-authored-by: Brandon Minnick <13558917+TheCodeTraveler@users.noreply.github.com> Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Co-authored-by: James Crutchley <ne0rmatrix@gmail.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
This PR adds two additional extension methods to
PopupExtensions.shared.cs
:After reading through @bijington's docs (amazing job, by the way!) , I realized that we don't give developers a way to close a Popup when they pass in a
View
(not passing in aPopup
):With this PR, developers can now use
PopupExtensions.Close()
:PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
This PR is targeting the #1581 PR. In other words, when this PR is merged, it will be merged into #1581, not the
main
branch.