-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathNavigationEventArgsExtensions.cs
More file actions
30 lines (26 loc) · 1.92 KB
/
NavigationEventArgsExtensions.cs
File metadata and controls
30 lines (26 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using CommunityToolkit.Maui.Views;
namespace CommunityToolkit.Maui.Extensions;
/// <summary>
/// Extension methods for <see cref="NavigatedFromEventArgs"/>, <see cref="NavigatedToEventArgs"/> and <see cref="NavigatingFromEventArgs"/>.
/// </summary>
public static class NavigationEventArgsExtensions
{
/// <summary>
/// Determines if the destination page is the internal <see cref="PopupPage"/> wrapper used when displaying a Community Toolkit <see cref="Popup"/>.
/// </summary>
/// <param name="args">The current <see cref="NavigatedFromEventArgs"/>.</param>
/// <returns>A boolean indicating if the destination page is a <see cref="PopupPage"/> representing a Community Toolkit <see cref="Popup"/>.</returns>
public static bool IsDestinationPageACommunityToolkitPopupPage(this NavigatedFromEventArgs args) => args.DestinationPage is PopupPage;
/// <summary>
/// Determines whether the previous page was the internal <see cref="PopupPage"/> wrapper used when displaying a Community Toolkit <see cref="Popup"/>.
/// </summary>
/// <param name="args">The current <see cref="NavigatedToEventArgs"/>.</param>
/// <returns>A boolean indicating whether the previous page was a <see cref="PopupPage"/> representing a Community Toolkit <see cref="Popup"/>.</returns>
public static bool WasPreviousPageACommunityToolkitPopupPage(this NavigatedToEventArgs args) => args.PreviousPage is PopupPage;
/// <summary>
/// Determines if the destination page will be the internal <see cref="PopupPage"/> wrapper used when displaying a Community Toolkit <see cref="Popup"/>.
/// </summary>
/// <param name="args">The current <see cref="NavigatingFromEventArgs"/>.</param>
/// <returns>A boolean indicating if the destination page will be a <see cref="PopupPage"/> representing a Community Toolkit <see cref="Popup"/>.</returns>
public static bool IsDestinationPageACommunityToolkitPopupPage(this NavigatingFromEventArgs args) => args.DestinationPage is PopupPage;
}