Skip to content

Commit 0bc2572

Browse files
bijingtonVladislavAntonyukTheCodeTravelerpictosne0rrmatrix
authored
Popup V2 (#1581)
* 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>
1 parent 12adc49 commit 0bc2572

File tree

141 files changed

+5120
-2836
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+5120
-2836
lines changed

.github/workflows/dotnet-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
NugetPackageVersionCamera: '99.0.0-preview${{ github.run_number }}'
2323
NugetPackageVersionMediaElement: '99.0.0-preview${{ github.run_number }}'
2424
NugetPackageVersionMaps: '99.0.0-preview${{ github.run_number }}'
25-
TOOLKIT_NET_VERSION: '9.0.202'
25+
TOOLKIT_NET_VERSION: '9.0.300'
2626
LATEST_NET_VERSION: '9.0.x'
2727
PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln'
2828
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln'

Directory.Build.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<NuGetAuditMode>all</NuGetAuditMode>
1717

1818
<!-- MAUI Specific -->
19-
<MauiPackageVersion>9.0.60</MauiPackageVersion>
19+
<MauiPackageVersion>9.0.70</MauiPackageVersion>
2020
<NextMauiPackageVersion>10.0.0</NextMauiPackageVersion>
2121
<MauiStrictXamlCompilation>true</MauiStrictXamlCompilation>
2222
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
@@ -170,6 +170,7 @@
170170
xUnit3002: Classes which are JSON serializable should not be tested for their concrete type
171171
XC0045: Binding: Property not found
172172
XC0103: Consider attributing the markup extension with [RequireService] or [AcceptEmptyServiceProvider] if it doesn't require any
173+
XC0618: Property, Property setter or BindableProperty "BackgroundColor" is deprecated
173174
IL2***: Trim Warnings
174175
IL3***: AOT Warnings
175176
RS2007: Analyzer release file 'AnalyzerReleases.Shipped.md' has a missing or invalid release header-->
@@ -182,7 +183,7 @@
182183
xUnit1000,xUnit1001,xUnit1002,xUnit1003,xUnit1004,xUnit1005,xUnit1006,xUnit1007,xUnit1008,xUnit1009,xUnit1010,xUnit1011,xUnit1012,xUnit1013,xUnit1014,xUnit1015,xUnit1016,xUnit1017,xUnit1018,xUnit1019,xUnit1020,xUnit1021,xUnit1022,xUnit1023,xUnit1024,xUnit1025,xUnit1026,xUnit1027,xUnit1028,xUnit1029,xUnit1030,xUnit1031,xUnit1032,xUnit1033,xUnit1034,xUnit1035,xUnit1036,xUnit1037,xUnit1038,xUnit1039,xUnit1040,xUnit1041,xUnit1042,xUnit1043,xUnit1048,xUnit1049,xUnit1050,xUnit1051,
183184
xUnit2000,xUnit2001,xUnit2002,xUnit2003,xUnit2004,xUnit2005,xUnit2006,xUnit2007,xUnit2008,xUnit2009,xUnit2010,xUnit2011,xUnit2012,xUnit2013,xUnit2014,xUnit2015,xUnit2016,xUnit2017,xUnit2018,xUnit2019,xUnit2020,xUnit2021,xUnit2022,xUnit2023,xUnit2024,xUnit2025,xUnit2026,xUnit2027,xUnit2028,xUnit2029,xUnit2030,xUnit2031,xUnit2032,
184185
xUnit3000,xUnit3001,xUnit3002,
185-
XC0045,XC0103,
186+
XC0045,XC0103,XC0618,
186187
IL2001,IL2002,IL2003,IL2004,IL2005,IL2006,IL2007,IL2008,IL2009,
187188
IL2010,IL2011,IL2012,IL2013,IL2014,IL2015,IL2016,IL2017,IL2018,IL2019,
188189
IL2020,IL2021,IL2022,IL2023,IL2024,IL2025,IL2026,IL2027,IL2028,IL2029,

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "9.0.202",
3+
"version": "9.0.300",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

samples/CommunityToolkit.Maui.Sample/App.xaml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,34 @@
1010
</ResourceDictionary.MergedDictionaries>
1111

1212
<Style TargetType="{x:Type popups:ImplicitStylePopup}">
13-
<Setter Property="Size" Value="100,100" />
14-
<Setter Property="Color" Value="Red" />
15-
<Setter Property="HorizontalOptions" Value="Start" />
16-
<Setter Property="VerticalOptions" Value="Start" />
17-
<Setter Property="CanBeDismissedByTappingOutsideOfPopup" Value="True" />
13+
<Setter Property="WidthRequest" Value="100" />
14+
<Setter Property="HeightRequest" Value="100" />
15+
<Setter Property="BackgroundColor" Value="Red" />
1816
</Style>
1917

2018
<Style x:Key="ExplicitPopupStyle" TargetType="{x:Type popups:ExplicitStylePopup}">
21-
<Setter Property="Size" Value="200,100" />
22-
<Setter Property="Color" Value="Yellow" />
23-
<Setter Property="HorizontalOptions" Value="End" />
24-
<Setter Property="VerticalOptions" Value="Start" />
25-
<Setter Property="CanBeDismissedByTappingOutsideOfPopup" Value="True" />
19+
<Setter Property="WidthRequest" Value="200" />
20+
<Setter Property="HeightRequest" Value="100" />
21+
<Setter Property="BackgroundColor" Value="Yellow" />
2622
</Style>
2723

2824
<Style x:Key="BasePopupStyle" TargetType="{x:Type popups:StyleInheritancePopup}">
29-
<Setter Property="Size" Value="200,200" />
25+
<Setter Property="WidthRequest" Value="200" />
26+
<Setter Property="HeightRequest" Value="200" />
3027
</Style>
3128
<Style x:Key="InheritancePopupStyle" TargetType="{x:Type popups:StyleInheritancePopup}" BasedOn="{StaticResource BasePopupStyle}">
32-
<Setter Property="Color" Value="SkyBlue" />
33-
<Setter Property="HorizontalOptions" Value="End" />
34-
<Setter Property="VerticalOptions" Value="End" />
35-
<Setter Property="CanBeDismissedByTappingOutsideOfPopup" Value="True" />
29+
<Setter Property="BackgroundColor" Value="SkyBlue" />
3630
</Style>
3731

3832
<Style x:Key="DynamicBasePopupStyle" TargetType="{x:Type popups:DynamicStyleInheritancePopup}">
39-
<Setter Property="Size" Value="150,150" />
33+
<Setter Property="WidthRequest" Value="150" />
34+
<Setter Property="HeightRequest" Value="150" />
4035
</Style>
4136
<Style x:Key="DynamicInheritancePopupStyle1" TargetType="{x:Type popups:DynamicStyleInheritancePopup}" BasedOn="{StaticResource DynamicBasePopupStyle}">
42-
<Setter Property="Color" Value="Purple" />
43-
<Setter Property="VerticalOptions" Value="End" />
37+
<Setter Property="BackgroundColor" Value="Purple" />
4438
</Style>
4539
<Style x:Key="DynamicInheritancePopupStyle2" TargetType="{x:Type popups:DynamicStyleInheritancePopup}" BaseResourceKey="DynamicInheritancePopupStyle1">
46-
<Setter Property="Color" Value="Orange" />
47-
<Setter Property="HorizontalOptions" Value="End" />
48-
<Setter Property="CanBeDismissedByTappingOutsideOfPopup" Value="True" />
40+
<Setter Property="BackgroundColor" Value="Orange" />
4941
</Style>
5042

5143
</ResourceDictionary>

samples/CommunityToolkit.Maui.Sample/AppShell.xaml.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public partial class AppShell : Shell
120120
CreateViewModelMapping<AvatarViewSizesPage, AvatarViewSizesViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
121121
CreateViewModelMapping<BasicMapsPage, BasicMapsViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
122122
CreateViewModelMapping<CameraViewPage, CameraViewViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
123-
CreateViewModelMapping<CustomSizeAndPositionPopupPage, CustomSizeAndPositionPopupViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
124123
CreateViewModelMapping<DrawingViewPage, DrawingViewViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
125124
CreateViewModelMapping<ExpanderPage, ExpanderViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
126125
CreateViewModelMapping<LazyViewPage, LazyViewViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
@@ -129,17 +128,16 @@ public partial class AppShell : Shell
129128
CreateViewModelMapping<MediaElementCarouselViewPage, MediaElementCarouselViewViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
130129
CreateViewModelMapping<MediaElementCollectionViewPage, MediaElementCollectionViewViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
131130
CreateViewModelMapping<MediaElementMultipleWindowsPage, MediaElementMultipleWindowsViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
132-
CreateViewModelMapping<MultiplePopupPage, MultiplePopupViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
133-
CreateViewModelMapping<PopupAnchorPage, PopupAnchorViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
131+
CreateViewModelMapping<SemanticOrderViewPage, SemanticOrderViewPageViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
132+
CreateViewModelMapping<PopupsPage, PopupsViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
134133
CreateViewModelMapping<PopupLayoutAlignmentPage, PopupLayoutAlignmentViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
135134
CreateViewModelMapping<PopupPositionPage, PopupPositionViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
136135
CreateViewModelMapping<PopupSizingIssuesPage, PopupSizingIssuesViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
136+
CreateViewModelMapping<ShowPopupInOnAppearingPage, ShowPopupInOnAppearingPageViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
137+
CreateViewModelMapping<StylePopupPage, StylePopupViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
137138
CreateViewModelMapping<RatingViewCsharpPage, RatingViewCsharpViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
138139
CreateViewModelMapping<RatingViewShowcasePage, RatingViewShowcaseViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
139140
CreateViewModelMapping<RatingViewXamlPage, RatingViewXamlViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
140-
CreateViewModelMapping<SemanticOrderViewPage, SemanticOrderViewPageViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
141-
CreateViewModelMapping<ShowPopupInOnAppearingPage, ShowPopupInOnAppearingPageViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
142-
CreateViewModelMapping<StylePopupPage, StylePopupViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
143141

144142
// Add PlatformSpecific View Models
145143
CreateViewModelMapping<NavigationBarPage, NavigationBarAndroidViewModel, PlatformSpecificGalleryPage, PlatformSpecificGalleryViewModel>()

samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
<NoWarn>CsWinRT1028</NoWarn>
3636
</PropertyGroup>
3737

38-
<PropertyGroup Condition="'$(Configuration)' == 'Release'
39-
AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'tizen'
40-
AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'android'
41-
AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
38+
<PropertyGroup Condition="'$(Configuration)' == 'Release'
39+
AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'tizen'
40+
AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'android'
41+
AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
4242
<!-- Ahead-of-time compilation is not yet supported net8.0-tizen -->
4343
<!-- Cross-OS native compilation is not supported net8.0-android -->
4444
<!-- Only iOS + MacCatalyst support AOT in .NET 9 -->
@@ -64,10 +64,10 @@
6464
<MauiFont Include="Resources\Fonts\*" />
6565

6666
<PackageReference Include="Microsoft.Maui.Controls" Version="*" />
67-
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="5.1.0" />
67+
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="6.0.0" />
6868
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
69-
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.4.0" />
70-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.4" />
69+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.5.0" />
70+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.5" />
7171
</ItemGroup>
7272

7373
<PropertyGroup>

samples/CommunityToolkit.Maui.Sample/MauiProgram.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using CommunityToolkit.Maui.Core;
44
using CommunityToolkit.Maui.Markup;
55
using CommunityToolkit.Maui.Media;
6-
using CommunityToolkit.Maui.Sample.Models;
76
using CommunityToolkit.Maui.Sample.Pages;
87
using CommunityToolkit.Maui.Sample.Pages.Alerts;
98
using CommunityToolkit.Maui.Sample.Pages.Behaviors;
@@ -124,7 +123,6 @@ public static MauiApp CreateMauiApp()
124123
.AddStandardResilienceHandler(static options => options.Retry = new MobileHttpRetryStrategyOptions());
125124

126125
builder.Services.AddSingleton<AppShell>();
127-
builder.Services.AddSingleton<PopupSizeConstants>();
128126

129127
RegisterViewsAndViewModels(builder.Services);
130128
RegisterEssentials(builder.Services);
@@ -249,7 +247,6 @@ static void RegisterViewsAndViewModels(in IServiceCollection services)
249247
// Add Views Pages + ViewModels
250248
services.AddTransientWithShellRoute<BasicMapsPage, BasicMapsViewModel>();
251249
services.AddTransientWithShellRoute<CameraViewPage, CameraViewViewModel>();
252-
services.AddTransientWithShellRoute<CustomSizeAndPositionPopupPage, CustomSizeAndPositionPopupViewModel>();
253250
services.AddTransientWithShellRoute<DrawingViewPage, DrawingViewViewModel>();
254251
services.AddTransientWithShellRoute<ExpanderPage, ExpanderViewModel>();
255252
services.AddTransientWithShellRoute<LazyViewPage, LazyViewViewModel>();
@@ -258,8 +255,7 @@ static void RegisterViewsAndViewModels(in IServiceCollection services)
258255
services.AddTransientWithShellRoute<MediaElementCarouselViewPage, MediaElementCarouselViewViewModel>();
259256
services.AddTransientWithShellRoute<MediaElementCollectionViewPage, MediaElementCollectionViewViewModel>();
260257
services.AddTransientWithShellRoute<MediaElementMultipleWindowsPage, MediaElementMultipleWindowsViewModel>();
261-
services.AddTransientWithShellRoute<MultiplePopupPage, MultiplePopupViewModel>();
262-
services.AddTransientWithShellRoute<PopupAnchorPage, PopupAnchorViewModel>();
258+
services.AddTransientWithShellRoute<PopupsPage, PopupsViewModel>();
263259
services.AddTransientWithShellRoute<PopupLayoutAlignmentPage, PopupLayoutAlignmentViewModel>();
264260
services.AddTransientWithShellRoute<PopupPositionPage, PopupPositionViewModel>();
265261
services.AddTransientWithShellRoute<RatingViewCsharpPage, RatingViewCsharpViewModel>();
@@ -271,7 +267,24 @@ static void RegisterViewsAndViewModels(in IServiceCollection services)
271267
services.AddTransientWithShellRoute<PopupSizingIssuesPage, PopupSizingIssuesViewModel>();
272268

273269
// Add Popups
270+
services.AddTransientPopup<ApplyToDerivedTypesPopup>();
271+
services.AddTransientPopup<ButtonPopup>();
274272
services.AddTransientPopup<CsharpBindingPopup, CsharpBindingPopupViewModel>();
273+
services.AddTransientPopup<DynamicStyleInheritancePopup>();
274+
services.AddTransientPopup<DynamicStylePopup>();
275+
services.AddTransientPopup<ExplicitStylePopup>();
276+
services.AddTransientPopup<ImplicitStylePopup>();
277+
services.AddTransientPopup<MultipleButtonPopup>();
278+
services.AddTransientPopup<NoOutsideTapDismissPopup>();
279+
services.AddTransientPopup<OpenedEventSimplePopup>();
280+
services.AddTransientPopup<PopupContentView, PopupContentViewModel>();
281+
services.AddTransientPopup<RedBlueBoxPopup>();
282+
services.AddTransientPopup<ReturnResultPopup>();
283+
services.AddTransientPopup<SimplePopup>();
284+
services.AddTransientPopup<StyleClassPopup>();
285+
services.AddTransientPopup<StyleInheritancePopup>();
286+
services.AddTransientPopup<ToggleSizePopup>();
287+
services.AddTransientPopup<TransparentPopup>();
275288
services.AddTransientPopup<UpdatingPopup, UpdatingPopupViewModel>();
276289
services.AddTransientPopup<XamlBindingPopup, XamlBindingPopupViewModel>();
277290
}

samples/CommunityToolkit.Maui.Sample/Models/PopupSize.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public IsInRangeConverterPage(IsInRangeConverterViewModel viewModel) : base(view
296296
.Start().CenterVertical()
297297
.Bind(Entry.TextProperty,
298298
static (IsInRangeConverterViewModel vm) => vm.InputString,
299-
static (IsInRangeConverterViewModel vm, string text) => vm.InputString = text),
299+
static (IsInRangeConverterViewModel vm, string? text) => vm.InputString = text ?? string.Empty),
300300

301301
new ExampleLabel()
302302
.Row(Row.CharExample1).Column(Column.Input)

samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml.cs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System.ComponentModel;
22
using CommunityToolkit.Maui.Core;
3+
using CommunityToolkit.Maui.Extensions;
34
using CommunityToolkit.Maui.Sample.Constants;
45
using CommunityToolkit.Maui.Sample.ViewModels.Views;
56
using CommunityToolkit.Maui.Views;
67
using Microsoft.Extensions.Logging;
7-
using LayoutAlignment = Microsoft.Maui.Primitives.LayoutAlignment;
88

99
namespace CommunityToolkit.Maui.Sample.Pages.Views;
1010

@@ -243,36 +243,18 @@ async void ChangeAspectClicked(object? sender, EventArgs e)
243243
MediaElement.Aspect = (Aspect)aspectEnum;
244244
}
245245

246-
void DisplayPopup(object sender, EventArgs e)
246+
async void DisplayPopup(object sender, EventArgs e)
247247
{
248248
MediaElement.Pause();
249249
var popupMediaElement = new MediaElement
250250
{
251251
AndroidViewType = AndroidViewType.SurfaceView,
252252
Source = MediaSource.FromResource("AppleVideo.mp4"),
253-
MetadataArtworkUrl = botImageUrl,
254-
HeightRequest = 600,
255-
WidthRequest = 600,
256253
ShouldAutoPlay = true,
257254
ShouldShowPlaybackControls = true,
258255
};
259-
var popup = new Popup
260-
{
261-
VerticalOptions = LayoutAlignment.Center,
262-
HorizontalOptions = LayoutAlignment.Center,
263-
Content = new StackLayout
264-
{
265-
Children =
266-
{
267-
popupMediaElement,
268-
}
269-
}
270-
};
271-
272-
this.ShowPopup(popup);
273-
popup.Closed += (s, e) =>
274-
{
275-
popupMediaElement.Stop();
276-
};
256+
257+
await this.ShowPopupAsync(popupMediaElement);
258+
popupMediaElement.Stop();
277259
}
278260
}

0 commit comments

Comments
 (0)