diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml
index ea695717ac..a3d2798aa2 100644
--- a/.github/workflows/benchmarks.yml
+++ b/.github/workflows/benchmarks.yml
@@ -13,7 +13,7 @@ on:
- '*'
env:
- LATEST_NET_VERSION: '9.0.x'
+ LATEST_NET_VERSION: '10.0.x'
PathToCommunityToolkitAnalyzersBenchmarkCsproj: 'src/CommunityToolkit.Maui.Analyzers.Benchmarks/CommunityToolkit.Maui.Analyzers.Benchmarks.csproj'
concurrency:
@@ -42,7 +42,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.LATEST_NET_VERSION }}
- dotnet-quality: 'ga'
+ dotnet-quality: 'preview'
- name: Install .NET MAUI Workload
run: |
diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml
index e9c5da3524..12ca67447f 100644
--- a/.github/workflows/dotnet-build.yml
+++ b/.github/workflows/dotnet-build.yml
@@ -22,8 +22,8 @@ env:
NugetPackageVersionCamera: '99.0.0-preview${{ github.run_number }}'
NugetPackageVersionMediaElement: '99.0.0-preview${{ github.run_number }}'
NugetPackageVersionMaps: '99.0.0-preview${{ github.run_number }}'
- TOOLKIT_NET_VERSION: '9.0.306'
- LATEST_NET_VERSION: '9.0.x'
+ TOOLKIT_NET_VERSION: '10.0.x'
+ LATEST_NET_VERSION: '10.0.x'
PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln'
PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj'
@@ -71,12 +71,12 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.LATEST_NET_VERSION }}
- dotnet-quality: 'ga'
+ dotnet-quality: 'preview'
- uses: actions/setup-java@v5
with:
distribution: 'microsoft'
- java-version: '17'
+ java-version: '21'
- name: Install .NET MAUI Workload
run: |
@@ -145,7 +145,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.TOOLKIT_NET_VERSION }}
- dotnet-quality: 'ga'
+ dotnet-quality: 'preview'
- uses: actions/setup-java@v5
with:
@@ -273,7 +273,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.TOOLKIT_NET_VERSION }}
- dotnet-quality: 'ga'
+ dotnet-quality: 'preview'
- name: Download NuGet List
uses: actions/download-artifact@v5
@@ -345,7 +345,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.TOOLKIT_NET_VERSION }}
- dotnet-quality: 'ga'
+ dotnet-quality: 'preview'
- name: Download signed packages
uses: actions/download-artifact@v5
@@ -373,7 +373,7 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.TOOLKIT_NET_VERSION }}
- dotnet-quality: 'ga'
+ dotnet-quality: 'preview'
- name: Download signed packages
uses: actions/download-artifact@v5
diff --git a/Directory.Build.props b/Directory.Build.props
index b40f60d699..2b4a93e517 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,8 +2,8 @@
enable
- NETSDK1023
- net9.0
+ NETSDK1023;XCODE_26_0_PREVIEW
+ net10.0
preview
enable
true
@@ -16,8 +16,7 @@
all
- 9.0.120
- 10.0.0
+ 10.0.0-rc.2.25504.7
true
true
true
@@ -203,7 +202,7 @@
IL2090,IL2091,IL2092,IL2093,IL2094,IL2095,IL2096,IL2097,IL2098,IL2099,
IL2100,IL2101,IL2102,IL2103,IL2104,IL2105,IL2106,IL2107,IL2108,IL2109,
IL2110,IL2111,IL2112,IL2113,IL2114,IL2115,IL2116,IL2117,IL2118,IL2119,
- IL2120,IL2121,IL2122,
+ IL2120,IL2121,IL2122,IL2123,
IL3050,IL3051,IL3052,IL3053,IL3054,IL3055,IL3056,
RS1038,RS2007
diff --git a/global.json b/global.json
index 214a6386b0..33b94ff507 100644
--- a/global.json
+++ b/global.json
@@ -1,7 +1,7 @@
{
"sdk": {
- "version": "9.0.306",
+ "version": "10.0.100-rc.2.25502.107",
"rollForward": "latestFeature",
- "allowPrerelease": false
+ "allowPrerelease": true
}
}
diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
index 3dbaf48846..f1954f806c 100644
--- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
+++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
@@ -7,6 +7,7 @@
Exe
true
true
+ true
CommunityToolkit.Maui.Sample
@@ -31,18 +32,15 @@
true
-
- CsWinRT1028
+ IL2026
-
-
-
- true
+ AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
+
+ false
+ true
+ partial
@@ -63,11 +61,11 @@
-
+
-
+
diff --git a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
index 1dd763355a..a8231b0d62 100644
--- a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
+++ b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
@@ -47,7 +47,6 @@ namespace CommunityToolkit.Maui.Sample;
public static class MauiProgram
{
- [RequiresUnreferencedCode($"{nameof(CommunityToolkit.Maui.Views.Expander)} and {nameof(TouchBehaviorCollectionViewMultipleSelectionPage)} are not type safe")]
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder()
@@ -135,8 +134,7 @@ public static MauiApp CreateMauiApp()
return builder.Build();
}
-
- [RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Sample.MauiProgram.AddTransientWithShellRoute()")]
+
static void RegisterViewsAndViewModels(in IServiceCollection services)
{
// Add Gallery Pages + ViewModels
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs
index 00acf9fdee..9d240eb4cd 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs
@@ -6,11 +6,10 @@
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors;
-[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Markup.BindableObjectExtensions.Bind(BindableProperty, String, BindingMode, IValueConverter, Object, String, Object, Object, Object)")]
public partial class TouchBehaviorCollectionViewMultipleSelectionPage : BasePage
{
readonly CollectionView collectionView;
-
+
public TouchBehaviorCollectionViewMultipleSelectionPage(TouchBehaviorCollectionViewMultipleSelectionViewModel viewModel) : base(viewModel)
{
Content = new VerticalStackLayout
@@ -37,12 +36,9 @@ async void HandleSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
await Toast.Make($"Number of Creators Selected: {collectionView.SelectedItems?.Count ?? 0}").Show();
}
-
-
- [RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Markup.BindableObjectExtensions.Bind(BindableProperty, String, BindingMode, IValueConverter, Object, String, Object, Object, Object)")]
+
sealed class CreatorsDataTemplate(TouchBehaviorCollectionViewMultipleSelectionViewModel viewModel) : DataTemplate(() => CreateLayout(viewModel))
{
- [RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Markup.BindableObjectExtensions.Bind(BindableProperty, String, BindingMode, IValueConverter, Object, String, Object, Object, Object)")]
static VerticalStackLayout CreateLayout(TouchBehaviorCollectionViewMultipleSelectionViewModel viewModel) => new VerticalStackLayout
{
Children =
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs
index 71b812cd7f..4f4c17f49d 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs
@@ -235,7 +235,7 @@ public IsInRangeConverterPage(IsInRangeConverterViewModel viewModel) : base(view
.Row(Row.TimeSpanExample1).Column(Column.Result)
.TextCenter()
.Bind
-
+
diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj b/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj
index d71c97d2e5..341c82b65c 100644
--- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj
+++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj
@@ -20,13 +20,13 @@
-
-
+
+
-
+
diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs
index c0936edd28..0b259934af 100644
--- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs
+++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs
@@ -6,12 +6,14 @@ namespace CommunityToolkit.Maui.Analyzers.UnitTests;
public static partial class CSharpAnalyzerVerifier
where TAnalyzer : DiagnosticAnalyzer, new()
{
- public class Test : CSharpAnalyzerTest
+ class Test : CSharpAnalyzerTest
{
public Test(params ReadOnlySpan assembliesUnderTest)
{
-#if NET9_0
+#if NET9
ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net90;
+#elif NET10
+ ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net10;
#else
#error ReferenceAssemblies must be updated to current version of .NET
#endif
diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs
index 81797f7ab1..4751c06c52 100644
--- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs
+++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs
@@ -9,11 +9,11 @@ public static partial class CSharpCodeFixVerifier
where TAnalyzer : DiagnosticAnalyzer, new()
where TCodeFix : CodeFixProvider, new()
{
- protected class Test : CSharpCodeFixTest
+ class Test : CSharpCodeFixTest
{
public Test(params ReadOnlySpan assembliesUnderTest)
{
-#if NET9_0
+#if NET9
ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net90;
#else
#error ReferenceAssemblies must be updated to current version of .NET
diff --git a/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj b/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
index c7ffd9094a..1342ad2678 100644
--- a/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj b/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj
index 5e9d7cfa21..2ab2e8f7fb 100644
--- a/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj
+++ b/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj b/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
index 4fcf2ceac9..ff376830b7 100644
--- a/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj
index e318badb0f..65002f6b67 100644
--- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj
+++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj
@@ -43,6 +43,7 @@
true
dotnet,maui,toolkit,kit,communitytoolkit,dotnetcommunitytoolkit,cameraview,camera,photo
Debug;Release
+ true
@@ -61,7 +62,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs b/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs
index 9f4b12f36c..f15859fc04 100644
--- a/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs
+++ b/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs
@@ -6,11 +6,7 @@ namespace CommunityToolkit.Maui.Core.Handlers;
///
/// Handler definition for the implementation on each platform.
///
-#if TIZEN
-public class CameraViewHandler : ViewHandler
-#else
public partial class CameraViewHandler : ViewHandler, IDisposable
-#endif
{
///
/// The currently defined mappings between properties on the and
diff --git a/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj b/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj
index 5cbed9631a..254f011656 100644
--- a/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj
+++ b/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj
@@ -7,6 +7,7 @@
true
true
true
+ true
true
@@ -51,8 +52,8 @@
-
-
+
+
diff --git a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopUpHandler.android.cs b/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopUpHandler.android.cs
deleted file mode 100644
index 23c8cc63b5..0000000000
--- a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopUpHandler.android.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-using CommunityToolkit.Maui.Core.Views;
-using Microsoft.Maui.Handlers;
-using Microsoft.Maui.Platform;
-using AView = Android.Views.View;
-
-namespace CommunityToolkit.Maui.Core.Handlers;
-
-public partial class PopupHandler : ElementHandler
-{
- internal AView? Container { get; set; }
- internal int LastPopupWidth { get; set; }
- internal int LastPopupHeight { get; set; }
- internal double LastWindowWidth { get; set; }
- internal double LastWindowHeight { get; set; }
-
- ///
- /// Action that's triggered when the Popup is closed
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnClosed(PopupHandler handler, IPopup view, object? result)
- {
- var popup = handler.PlatformView;
-
- if (!popup.Context.GetActivity().IsDestroyed())
- {
- if (popup.IsShowing)
- {
- popup.Dismiss();
- }
- }
-
- view.HandlerCompleteTCS.TrySetResult();
-
- handler.DisconnectHandler(popup);
- }
-
- ///
- /// Action that's triggered when the Popup is Opened.
- ///
- /// An instance of .
- /// An instance of .
- /// We don't need to provide the result parameter here.
- public static void MapOnOpened(PopupHandler handler, IPopup view, object? result)
- {
- handler.PlatformView.Show();
- }
-
- ///
- /// Action that's triggered when the Popup is dismissed by tapping outside of the popup.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view, object? result)
- {
- if (view.CanBeDismissedByTappingOutsideOfPopup)
- {
- view.OnDismissedByTappingOutsideOfPopup();
- }
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapAnchor(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetAnchor(view);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapCanBeDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetCanBeDismissedByTappingOutsideOfPopup(view);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapColor(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetColor(view);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapSize(PopupHandler handler, IPopup view)
- {
- ArgumentNullException.ThrowIfNull(handler.Container);
-
- handler.PlatformView.SetSize(view, handler.Container, handler);
- }
-
- ///
- protected override MauiPopup CreatePlatformElement()
- {
- _ = MauiContext ?? throw new InvalidOperationException("MauiContext is null, please check your MauiApplication.");
- _ = MauiContext.Context ?? throw new InvalidOperationException("Android Context is null, please check your MauiApplication.");
-
- return new MauiPopup(MauiContext.Context, MauiContext);
- }
-
- ///
- protected override void ConnectHandler(MauiPopup platformView)
- {
- Container = platformView.SetElement(VirtualView);
-
- if (Container is not null)
- {
- Container.LayoutChange += OnLayoutChange;
- }
- }
-
- ///
- protected override void DisconnectHandler(MauiPopup platformView)
- {
- platformView.Dispose();
-
- if (Container is not null)
- {
- Container.LayoutChange -= OnLayoutChange;
- }
- }
-
- void OnShowed(object? sender, EventArgs args)
- {
- _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null");
-
- VirtualView.OnOpened();
- }
-
- void OnLayoutChange(object? sender, EventArgs e)
- {
- if (VirtualView?.Handler?.PlatformView is Dialog dialog && Container is not null)
- {
- PopupExtensions.SetSize(dialog, VirtualView, Container, this);
- }
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopUpHandler.windows.cs b/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopUpHandler.windows.cs
deleted file mode 100644
index 0ea2845638..0000000000
--- a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopUpHandler.windows.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-using CommunityToolkit.Maui.Core.Extensions;
-using CommunityToolkit.Maui.Core.Views;
-using Microsoft.Maui.Handlers;
-using Microsoft.Maui.Platform;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Windows.UI.ViewManagement;
-
-namespace CommunityToolkit.Maui.Core.Handlers;
-
-public partial class PopupHandler : ElementHandler
-{
- ///
- /// Action that's triggered when the Popup is Dismissed.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnClosed(PopupHandler handler, IPopup view, object? result)
- {
- var window = view.GetWindow();
- if (window.Overlays.FirstOrDefault() is IWindowOverlay popupOverlay)
- {
- window.RemoveOverlay(popupOverlay);
- }
-
- view.HandlerCompleteTCS.TrySetResult();
- handler.DisconnectHandler(handler.PlatformView);
- }
-
- ///
- /// Action that's triggered when the Popup is Opened.
- ///
- /// An instance of .
- /// An instance of .
- /// We don't need to provide the result parameter here.
- public static void MapOnOpened(PopupHandler handler, IPopup view, object? result)
- {
- ArgumentNullException.ThrowIfNull(view.Parent);
- ArgumentNullException.ThrowIfNull(handler.MauiContext);
-
- var parent = view.Parent.ToPlatform(handler.MauiContext);
- parent.IsHitTestVisible = false;
- handler.PlatformView.XamlRoot = view.GetWindow().Content?.Handler?.MauiContext?.GetPlatformWindow().Content.XamlRoot ?? throw new InvalidOperationException("Window Content cannot be null");
- handler.PlatformView.IsHitTestVisible = true;
- handler.PlatformView.IsOpen = true;
-
- AddOverlayToWindow(view.GetWindow());
-
- view.OnOpened();
- }
-
-
- ///
- /// Action that's triggered when the Popup is dismissed by tapping outside of the Popup.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view, object? result)
- {
- view.OnDismissedByTappingOutsideOfPopup();
- handler.DisconnectHandler(handler.PlatformView);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapAnchor(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetAnchor(view, handler.MauiContext);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapCanBeDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.IsLightDismissEnabled = view.CanBeDismissedByTappingOutsideOfPopup;
- handler.PlatformView.LightDismissOverlayMode = LightDismissOverlayMode.Off;
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapColor(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetColor(view);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapSize(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetSize(view, handler.MauiContext);
- }
-
- ///
- protected override void DisconnectHandler(Popup platformView)
- {
- if (VirtualView.Parent is null)
- {
- return;
- }
-
- ArgumentNullException.ThrowIfNull(VirtualView.Handler?.MauiContext);
- var parent = VirtualView.Parent.ToPlatform(VirtualView.Handler.MauiContext);
- parent.IsHitTestVisible = true;
- platformView.IsOpen = false;
- platformView.Closed -= OnClosed;
- if (MauiContext is not null)
- {
- MauiContext.GetPlatformWindow().SizeChanged -= OnSizeChanged;
- }
- }
-
- ///
- protected override Popup CreatePlatformElement()
- {
- var popup = new Popup();
- return popup;
- }
-
- ///
- protected override void ConnectHandler(Popup platformView)
- {
- platformView.Closed += OnClosed;
- platformView.ConfigureControl(VirtualView, MauiContext);
- if (MauiContext is not null)
- {
- MauiContext.GetPlatformWindow().SizeChanged += OnSizeChanged;
- }
- base.ConnectHandler(platformView);
- }
-
- static void AddOverlayToWindow(IWindow window)
- {
- var uiSetting = new UISettings();
- var backgroundColor = uiSetting.GetColorValue(UIColorType.Background).ToColor();
- window.AddOverlay(new PopupOverlay(window, backgroundColor.IsDark()
- ? Color.FromRgba(0, 0, 0, 153)
- : Color.FromRgba(255, 255, 255, 153))); // 60% Opacity
- }
-
- void OnClosed(object? sender, object e)
- {
- if (!PlatformView.IsOpen && VirtualView.CanBeDismissedByTappingOutsideOfPopup)
- {
- VirtualView.Handler?.Invoke(nameof(IPopup.OnDismissedByTappingOutsideOfPopup));
- }
- }
-
- void OnSizeChanged(object? sender, WindowSizeChangedEventArgs e)
- {
- if (VirtualView is not null)
- {
- PopupExtensions.SetSize(PlatformView, VirtualView, MauiContext);
- PopupExtensions.SetLayout(PlatformView, VirtualView, MauiContext);
- }
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.macios.cs b/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.macios.cs
deleted file mode 100644
index 809f8a3ecd..0000000000
--- a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.macios.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using CommunityToolkit.Maui.Core.Views;
-using Microsoft.Maui.Handlers;
-
-namespace CommunityToolkit.Maui.Core.Handlers;
-
-public partial class PopupHandler : ElementHandler
-{
- ///
- /// Action that's triggered when the Popup is Dismissed.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static async void MapOnClosed(PopupHandler handler, IPopup view, object? result)
- {
- var presentationController = handler.PlatformView.PresentationController;
- if (presentationController?.PresentedViewController is UIViewController presentationViewController)
- {
- await presentationViewController.DismissViewControllerAsync(true);
- }
-
- view.HandlerCompleteTCS.TrySetResult();
-
- handler.DisconnectHandler(handler.PlatformView);
- }
-
- ///
- /// Action that's triggered when the Popup is dismissed by tapping outside of the Popup.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view, object? result)
- {
- if (handler.PlatformView is not MauiPopup popupRenderer)
- {
- throw new InvalidOperationException($"{nameof(handler.PlatformView)} must be of type {typeof(PopupHandler)}.");
- }
-
- if (popupRenderer.IsViewLoaded && view.CanBeDismissedByTappingOutsideOfPopup)
- {
- view.OnDismissedByTappingOutsideOfPopup();
- }
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
-
- public static void MapAnchor(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetSize(view);
- handler.PlatformView.SetLayout(view);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapCanBeDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetCanBeDismissedByTappingOutsideOfPopup(view);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapColor(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetBackgroundColor(view);
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapSize(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.SetSize(view);
- handler.PlatformView.SetLayout(view);
- }
-
- ///
- protected override void ConnectHandler(MauiPopup platformView)
- {
- base.ConnectHandler(platformView);
- platformView.SetElement(VirtualView);
- }
-
- ///
- protected override MauiPopup CreatePlatformElement()
- {
- return new MauiPopup(MauiContext ?? throw new NullReferenceException(nameof(MauiContext)));
- }
-
- ///
- protected override void DisconnectHandler(MauiPopup platformView)
- {
- base.DisconnectHandler(platformView);
- platformView.CleanUp();
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.net.cs b/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.net.cs
deleted file mode 100644
index 5c307f03e0..0000000000
--- a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.net.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-namespace CommunityToolkit.Maui.Core.Handlers;
-
-public partial class PopupHandler : Microsoft.Maui.Handlers.ElementHandler
-{
- ///
- protected override object CreatePlatformElement() => throw new NotSupportedException();
-
- ///
- /// Action that's triggered when the Popup is closed.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnClosed(PopupHandler handler, IPopup view, object? result)
- {
- throw new NotSupportedException();
- }
-
- ///
- /// Action that's triggered when the Popup is Opened.
- ///
- /// An instance of .
- /// An instance of .
- /// We don't need to provide the result parameter here.
- public static void MapOnOpened(PopupHandler handler, IPopup view, object? result)
- {
- throw new NotSupportedException();
- }
-
- ///
- /// Action that's triggered when the Popup is dismissed by tapping outside of the Popup.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view, object? result)
- {
- throw new NotSupportedException();
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapAnchor(PopupHandler handler, IPopup view)
- {
- throw new NotSupportedException();
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapCanBeDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view)
- {
- throw new NotSupportedException();
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapColor(PopupHandler handler, IPopup view)
- {
- throw new NotSupportedException();
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapSize(PopupHandler handler, IPopup view)
- {
- throw new NotSupportedException();
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.shared.cs b/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.shared.cs
deleted file mode 100644
index 29cf972747..0000000000
--- a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.shared.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System.ComponentModel;
-
-namespace CommunityToolkit.Maui.Core.Handlers;
-
-///
-/// Handler Popup control
-///
-#if NET10_0_OR_GREATER
-#error Remove PopupHandler
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(PopupHandler)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public partial class PopupHandler
-{
- ///
- /// PropertyMapper for Popup Control
- ///
- public static IPropertyMapper PopUpMapper = new PropertyMapper(ElementMapper)
- {
- [nameof(IPopup.Anchor)] = MapAnchor,
- [nameof(IPopup.Color)] = MapColor,
- [nameof(IPopup.Size)] = MapSize,
- [nameof(IPopup.VerticalOptions)] = MapSize,
- [nameof(IPopup.HorizontalOptions)] = MapSize,
- [nameof(IPopup.CanBeDismissedByTappingOutsideOfPopup)] = MapCanBeDismissedByTappingOutsideOfPopup
- };
-
- ///
- /// for Popup Control.
- ///
- public static CommandMapper PopUpCommandMapper = new(ElementCommandMapper)
- {
-#if !(IOS || MACCATALYST)
- [nameof(IPopup.OnOpened)] = MapOnOpened,
- [nameof(IPopup.OnClosed)] = MapOnClosed,
-#endif
- [nameof(IPopup.OnDismissedByTappingOutsideOfPopup)] = MapOnDismissedByTappingOutsideOfPopup
- };
-
- ///
- /// Constructor for .
- ///
- /// Custom instance of , if it's null the will be used
- /// Custom instance of , if it's null the will be used
- public PopupHandler(IPropertyMapper? mapper, CommandMapper? commandMapper)
- : base(mapper ?? PopUpMapper, commandMapper ?? PopUpCommandMapper)
- {
- }
-
- ///
- /// Default Constructor for .
- ///
- public PopupHandler()
- : base(PopUpMapper, PopUpCommandMapper)
- {
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.tizen.cs b/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.tizen.cs
deleted file mode 100644
index e8755cfa18..0000000000
--- a/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.tizen.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using CommunityToolkit.Maui.Core.Views;
-using Tizen.UIExtensions.NUI;
-
-namespace CommunityToolkit.Maui.Core.Handlers;
-
-public partial class PopupHandler : Microsoft.Maui.Handlers.ElementHandler
-{
- ///
- /// Action that's triggered when the Popup is closed.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnClosed(PopupHandler handler, IPopup view, object? result)
- {
- var popup = handler.PlatformView;
-
- if (popup.IsOpen)
- {
- popup.Close();
- }
- view.HandlerCompleteTCS.TrySetResult();
-
- handler.DisconnectHandler(popup);
- }
-
- ///
- /// Action that's triggered when the Popup is Opened.
- ///
- /// An instance of .
- /// An instance of .
- /// We don't need to provide the result parameter here.
- public static void MapOnOpened(PopupHandler handler, IPopup view, object? result)
- {
- handler.PlatformView.ShowPopup();
- }
-
- ///
- /// Action that's triggered when the Popup is dismissed by tapping outside of the Popup.
- ///
- /// An instance of .
- /// An instance of .
- /// The result that should return from this Popup.
- public static void MapOnDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view, object? result)
- {
- if (view.CanBeDismissedByTappingOutsideOfPopup)
- {
- view.OnDismissedByTappingOutsideOfPopup();
- }
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapAnchor(PopupHandler handler, IPopup view)
- {
- // On Tizen, Anchor only update when popup is opened
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapCanBeDismissedByTappingOutsideOfPopup(PopupHandler handler, IPopup view)
- {
- // this property directly access on platform view
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapColor(PopupHandler handler, IPopup view)
- {
- // this property directly access on platform view
- }
-
- ///
- /// Action that's triggered when the Popup property changes.
- ///
- /// An instance of .
- /// An instance of .
- public static void MapSize(PopupHandler handler, IPopup view)
- {
- handler.PlatformView.UpdateContentSize();
- }
-
- ///
- protected override void ConnectHandler(MauiPopup platformView)
- {
- platformView.SetElement(VirtualView);
- }
-
- ///
- protected override MauiPopup CreatePlatformElement()
- {
- var mauiContext = MauiContext ?? throw new InvalidOperationException("${nameof(MauiContext)} cannot be null");
- return new MauiPopup(mauiContext);
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Interfaces/IPopup.shared.cs b/src/CommunityToolkit.Maui.Core/Interfaces/IPopup.shared.cs
deleted file mode 100644
index 3ae3d056ea..0000000000
--- a/src/CommunityToolkit.Maui.Core/Interfaces/IPopup.shared.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System.ComponentModel;
-using IElement = Microsoft.Maui.IElement;
-using LayoutAlignment = Microsoft.Maui.Primitives.LayoutAlignment;
-
-namespace CommunityToolkit.Maui.Core;
-
-///
-/// Represents a small View that pops up at front the Page.
-///
-#if NET10_0_OR_GREATER
-#error Remove IPopup
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(IPopup)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public interface IPopup : IElement, IVisualTreeElement, IAsynchronousHandler
-{
- ///
- /// Gets the View that Popup will be anchored.
- ///
- IView? Anchor { get; }
-
- ///
- /// Gets the Popup's color.
- ///
- Color? Color { get; }
-
- ///
- /// Gets the Popup's Content.
- ///
- IView? Content { get; }
-
- ///
- /// Gets the horizontal aspect of this element's arrangement in a container.
- ///
- LayoutAlignment HorizontalOptions { get; }
-
- ///
- /// Gets the CanBeDismissedByTappingOutsideOfPopup property.
- ///
- bool CanBeDismissedByTappingOutsideOfPopup { get; }
-
- ///
- /// Gets the Popup's size.
- ///
- Size Size { get; }
-
- ///
- /// Gets the vertical aspect of this element's arrangement in a container.
- ///
- LayoutAlignment VerticalOptions { get; }
-
- ///
- /// Occurs when the Popup is closed.
- ///
- /// Return value from the Popup.
- void OnClosed(object? result = null);
-
- ///
- /// Occurs when the Popup is opened.
- ///
- void OnOpened();
-
- ///
- /// Occurs when the Popup is dismissed by a user tapping outside the Popup.
- ///
- void OnDismissedByTappingOutsideOfPopup();
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.android.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.android.cs
deleted file mode 100644
index a89ed9e250..0000000000
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.android.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using Android.Content;
-using Android.Views;
-using Microsoft.Maui.Platform;
-using AView = Android.Views.View;
-
-namespace CommunityToolkit.Maui.Core.Views;
-
-///
-/// The native implementation of Popup control.
-///
-#if NET10_0_OR_GREATER
-#error Remove MauiPopup
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(MauiPopup)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public class MauiPopup : Dialog, IDialogInterfaceOnCancelListener
-{
- readonly IMauiContext mauiContext;
-
- ///
- /// Constructor of .
- ///
- /// An instance of .
- /// An instance of .
- /// If is null an exception will be thrown.
- public MauiPopup(Context context, IMauiContext mauiContext)
- : base(context)
- {
- this.mauiContext = mauiContext ?? throw new ArgumentNullException(nameof(mauiContext));
- }
-
- ///
- /// An instance of the .
- ///
- public IPopup? VirtualView { get; private set; }
-
- ///
- /// Method to initialize the native implementation.
- ///
- /// An instance of .
- public AView? SetElement(IPopup? element)
- {
- ArgumentNullException.ThrowIfNull(element);
-
- VirtualView = element;
-
- if (TryCreateContainer(VirtualView, out var container))
- {
- SubscribeEvents();
- }
-
- return container;
- }
-
- ///
- /// Method to show the Popup.
- ///
- public override void Show()
- {
- base.Show();
-
- _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null");
-
- VirtualView.OnOpened();
- }
-
- ///
- /// Method triggered when the Popup is dismissed by tapping outside of the Popup.
- ///
- /// An instance of the .
- public void OnDismissedByTappingOutsideOfPopup(IDialogInterface dialog)
- {
- _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null");
- _ = VirtualView.Handler ?? throw new InvalidOperationException($"{nameof(VirtualView.Handler)} cannot be null");
-
- VirtualView.Handler?.Invoke(nameof(IPopup.OnDismissedByTappingOutsideOfPopup));
- }
-
- ///
- /// Method to clean up the resources of the .
- ///
- public void CleanUp()
- {
- VirtualView = null;
- }
-
- ///
- public override bool OnTouchEvent(MotionEvent e)
- {
- if (VirtualView is not null)
- {
- if (VirtualView.CanBeDismissedByTappingOutsideOfPopup &&
- e.Action == MotionEventActions.Up)
- {
- if (Window?.DecorView is AView decorView)
- {
- float x = e.GetX();
- float y = e.GetY();
-
- if (!(x >= 0 && x <= decorView.Width && y >= 0 && y <= decorView.Height))
- {
- if (IsShowing)
- {
- OnDismissedByTappingOutsideOfPopup(this);
- }
- }
- }
- }
- }
-
- return !this.IsDisposed() && base.OnTouchEvent(e);
- }
-
- bool TryCreateContainer(in IPopup popup, [NotNullWhen(true)] out AView? container)
- {
- container = null;
-
- if (popup.Content is null)
- {
- return false;
- }
-
- container = popup.Content.ToPlatform(mauiContext);
- SetContentView(container);
-
- return true;
- }
-
- void SubscribeEvents()
- {
- SetOnCancelListener(this);
- }
-
- void IDialogInterfaceOnCancelListener.OnCancel(IDialogInterface? dialog) => OnDismissedByTappingOutsideOfPopup(this);
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs
deleted file mode 100644
index 4860b76ff7..0000000000
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using CommunityToolkit.Maui.Core.Extensions;
-using Microsoft.Maui.ApplicationModel;
-using Microsoft.Maui.Handlers;
-
-namespace CommunityToolkit.Maui.Core.Views;
-
-///
-/// The native implementation of Popup control.
-///
-///
-/// Constructor of .
-///
-/// An instance of .
-/// If is null an exception will be thrown.
-#if NET10_0_OR_GREATER
-#error Remove MauiPopup
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(MauiPopup)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public class MauiPopup(IMauiContext mauiContext) : UIViewController
-{
- readonly IMauiContext mauiContext = mauiContext ?? throw new ArgumentNullException(nameof(mauiContext));
-
- ///
- /// An instance of the that holds the .
- ///
- public PageHandler? Control { get; private set; }
-
- ///
- /// An instance of the .
- ///
- public IPopup? VirtualView { get; private set; }
-
- internal UIViewController? ViewController { get; private set; }
-
- ///
- /// Method to update the Popup's size.
- ///
- ///
- public void SetElementSize(Size size) =>
- Control?.ContainerView?.SizeThatFits(size);
-
- ///
- public override void ViewDidLayoutSubviews()
- {
- base.ViewDidLayoutSubviews();
-
- _ = View ?? throw new InvalidOperationException($"{nameof(View)} cannot be null.");
- _ = View.Superview ?? throw new InvalidOperationException($"{nameof(View.Superview)} cannot be null.");
-
- View.Superview.Layer.CornerRadius = 0.0f;
- View.Superview.Layer.MasksToBounds = false;
-
- if (PresentationController is not null)
- {
- SetShadowView(PresentationController.ContainerView);
- }
-
- SetElementSize(new Size(View.Bounds.Width, View.Bounds.Height));
-
- if (VirtualView is not null)
- {
- this.SetSize(VirtualView);
- this.SetLayout(VirtualView);
- }
- }
-
- ///
- public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
- {
- coordinator.AnimateAlongsideTransition(_ =>
- {
- // Before screen rotate
- }, _ =>
- {
- // After screen rotate
- if (VirtualView is not null)
- {
- this.SetSize(VirtualView);
- this.SetLayout(VirtualView);
- }
- });
-
- if (View is not null)
- {
- View.Bounds = new CGRect(0, 0, PreferredContentSize.Width, PreferredContentSize.Height);
- }
-
- base.ViewWillTransitionToSize(toSize, coordinator);
- }
-
- ///
- /// Method to initialize the native implementation.
- ///
- /// An instance of .
- [MemberNotNull(nameof(VirtualView), nameof(ViewController))]
- public void SetElement(IPopup element)
- {
-#if MACCATALYST
- if (element.Parent?.Handler is not PageHandler)
- {
- throw new InvalidOperationException($"The {nameof(element.Parent)} must be of type {typeof(PageHandler)}.");
- }
-#endif
-
- VirtualView = element;
- ModalPresentationStyle = UIModalPresentationStyle.Popover;
-
- _ = View ?? throw new InvalidOperationException($"{nameof(View)} cannot be null.");
- _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null.");
-
-#if MACCATALYST
- var pageHandler = VirtualView.Parent.Handler as PageHandler;
- var rootViewController = pageHandler?.ViewController ?? WindowStateManager.Default.GetCurrentUIViewController() ?? throw new InvalidOperationException($"{nameof(PageHandler.ViewController)} cannot be null.");
-#else
- var rootViewController = WindowStateManager.Default.GetCurrentUIViewController() ?? throw new InvalidOperationException($"{nameof(PageHandler.ViewController)} cannot be null.");
-#endif
-
- ViewController ??= rootViewController;
- }
-
- ///
- /// Method to clean up the resources of the .
- ///
- public void CleanUp()
- {
- if (VirtualView is null)
- {
- return;
- }
-
- VirtualView = null;
-
- if (PresentationController is UIPopoverPresentationController presentationController)
- {
- presentationController.Delegate = null;
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- [MemberNotNull(nameof(Control), nameof(ViewController))]
- public void CreateControl(Func func, in IPopup virtualView)
- {
- Control = func(virtualView);
-
- SetPresentationController();
-
- _ = View ?? throw new InvalidOperationException($"{nameof(View)} cannot be null.");
- SetView(View, Control);
-
- _ = ViewController ?? throw new InvalidOperationException($"{nameof(ViewController)} cannot be null.");
- AddToCurrentPageViewController(ViewController);
-
- this.SetSize(virtualView);
- this.SetLayout(virtualView);
- }
-
- static void SetShadowView(in UIView target)
- {
- if (target.Class.Name is "_UICutoutShadowView")
- {
- target.RemoveFromSuperview();
- }
-
- if (target.Class.Name is "_UIPopoverDimmingView")
- {
- target.BackgroundColor = UIColor.Black.ColorWithAlpha(0.4f);
- }
-
- foreach (var view in target.Subviews)
- {
- SetShadowView(view);
- }
- }
-
- void SetView(UIView view, IPlatformViewHandler control)
- {
- view.AddSubview(control.ViewController?.View ?? throw new InvalidOperationException($"{nameof(control.ViewController.View)} cannot be null."));
- view.Bounds = new CGRect(0, 0, PreferredContentSize.Width, PreferredContentSize.Height);
- AddChildViewController(control.ViewController);
-
- view.SafeTopAnchor().ConstraintEqualTo(control.ViewController.View.SafeTopAnchor()).Active = true;
- view.SafeBottomAnchor().ConstraintEqualTo(control.ViewController.View.SafeBottomAnchor()).Active = true;
- view.SafeLeadingAnchor().ConstraintEqualTo(control.ViewController.View.SafeLeadingAnchor()).Active = true;
- view.SafeTrailingAnchor().ConstraintEqualTo(control.ViewController.View.SafeTrailingAnchor()).Active = true;
-
- if (VirtualView is not null)
- {
- this.SetBackgroundColor(VirtualView);
- }
- }
-
- void SetPresentationController()
- {
- var popOverDelegate = new PopoverDelegate();
- popOverDelegate.PopoverDismissedEvent += HandlePopoverDelegateDismissed;
-
- var presentationController = (UIPopoverPresentationController)(PresentationController ?? throw new InvalidOperationException($"{nameof(PresentationController)} cannot be null."));
- presentationController.SourceView = ViewController?.View ?? throw new InvalidOperationException($"{nameof(ViewController.View)} cannot be null.");
-
- presentationController.Delegate = popOverDelegate;
- }
-
- [MemberNotNull(nameof(VirtualView))]
- void HandlePopoverDelegateDismissed(object? sender, UIPresentationController e)
- {
- _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null.");
- VirtualView.Handler?.Invoke(nameof(IPopup.OnDismissedByTappingOutsideOfPopup));
- }
-
- void AddToCurrentPageViewController(UIViewController viewController)
- {
- viewController.PresentViewController(this, true, null);
- }
-
- sealed class PopoverDelegate : UIPopoverPresentationControllerDelegate
- {
- readonly WeakEventManager popoverDismissedEventManager = new();
-
- public event EventHandler PopoverDismissedEvent
- {
- add => popoverDismissedEventManager.AddEventHandler(value);
- remove => popoverDismissedEventManager.RemoveEventHandler(value);
- }
-
- public override UIModalPresentationStyle GetAdaptivePresentationStyle(UIPresentationController forPresentationController) =>
- UIModalPresentationStyle.None;
-
- public override UIModalPresentationStyle GetAdaptivePresentationStyle(UIPresentationController controller, UITraitCollection traitCollection) =>
- UIModalPresentationStyle.None;
-
- public override void DidDismiss(UIPresentationController presentationController) =>
- popoverDismissedEventManager.HandleEvent(this, presentationController, nameof(PopoverDismissedEvent));
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.tizen.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.tizen.cs
deleted file mode 100644
index 6c6b0129d9..0000000000
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.tizen.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-using System.ComponentModel;
-using Microsoft.Maui.Platform;
-using Microsoft.Maui.Primitives;
-using Tizen.NUI;
-using Tizen.UIExtensions.NUI;
-using NHorizontalAlignment = Tizen.NUI.HorizontalAlignment;
-using NVerticalAlignment = Tizen.NUI.VerticalAlignment;
-
-namespace CommunityToolkit.Maui.Core.Views;
-
-///
-/// The native implementation of Popup control.
-///
-#if NET10_0_OR_GREATER
-#error Remove MauiPopup
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(MauiPopup)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public class MauiPopup : Popup
-{
- readonly IMauiContext mauiContext;
-
- ///
- /// Constructor of .
- ///
- /// An instance of .
- /// If is null an exception will be thrown.
- public MauiPopup(IMauiContext mauiContext)
- {
- this.mauiContext = mauiContext ?? throw new ArgumentNullException(nameof(mauiContext));
- OutsideClicked += OnOutsideClicked;
- }
-
- ///
- /// An instance of the .
- ///
- public IPopup? VirtualView { get; private set; }
-
- ///
- protected override void Dispose(bool isDisposing)
- {
- if (isDisposing)
- {
- OutsideClicked -= OnOutsideClicked;
- }
-
- base.Dispose(isDisposing);
- }
-
- ///
- /// Method to initialize the native implementation.
- ///
- /// An instance of .
- public void SetElement(IPopup? element)
- {
- VirtualView = element;
- }
-
- ///
- /// Method to show the Popup
- ///
- public void ShowPopup()
- {
- _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null");
- Content = VirtualView.Content?.ToPlatform(mauiContext) ?? throw new InvalidOperationException($"{nameof(VirtualView.Content)} cannot be null");
-
- BackgroundColor = new Tizen.NUI.Color(0.1f, 0.1f, 0.1f, 0.5f);
- Content.BackgroundColor = (VirtualView.Color ?? Colors.Transparent).ToNUIColor();
-
- if (VirtualView.Anchor is not null)
- {
- var anchorView = VirtualView.Anchor.ToPlatform();
- var anchorPosition = anchorView.ScreenPosition;
- Layout = new AbsoluteLayout();
- Content.UpdatePosition(new Tizen.UIExtensions.Common.Point(anchorPosition.X, anchorPosition.Y));
- }
- else
- {
- Layout = new LinearLayout
- {
- LinearOrientation = LinearLayout.Orientation.Vertical,
- VerticalAlignment = ToVerticalAlignment(VirtualView.VerticalOptions),
- HorizontalAlignment = ToHorizontalAlignment(VirtualView.Content.FlowDirection, VirtualView.HorizontalOptions),
- };
- Content.UpdatePosition(new Tizen.UIExtensions.Common.Point(0, 0));
- }
-
- UpdateContentSize();
-
- Open();
- VirtualView.OnOpened();
- }
-
- ///
- /// Method to update size of Content
- ///
- ///
- public void UpdateContentSize()
- {
- _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null");
- if (Content is null)
- {
- return;
- }
-
- if (VirtualView.Size.Width > 0 && VirtualView.Size.Height > 0)
- {
- Content.UpdateSize(VirtualView.Size.ToPixel());
- }
- else
- {
- var measured = VirtualView.Content?.Measure(double.PositiveInfinity, double.PositiveInfinity).ToPixel() ?? new Tizen.UIExtensions.Common.Size(0, 0);
- Content.UpdateSize(measured);
- }
- }
-
- static NVerticalAlignment ToVerticalAlignment(LayoutAlignment align) => align switch
- {
- LayoutAlignment.Start => NVerticalAlignment.Top,
- LayoutAlignment.End => NVerticalAlignment.Bottom,
- _ => NVerticalAlignment.Center
- };
-
- static NHorizontalAlignment ToHorizontalAlignment(FlowDirection direction, LayoutAlignment align) => align switch
- {
- LayoutAlignment.Start => direction == FlowDirection.RightToLeft ? NHorizontalAlignment.End : NHorizontalAlignment.Begin,
- LayoutAlignment.End => direction == FlowDirection.RightToLeft ? NHorizontalAlignment.Begin : NHorizontalAlignment.End,
- _ => NHorizontalAlignment.Center
- };
-
- void OnOutsideClicked(object? sender, EventArgs e)
- {
- if (VirtualView?.Handler is null)
- {
- return;
- }
-
- if (VirtualView.CanBeDismissedByTappingOutsideOfPopup)
- {
- Close();
- VirtualView.Handler?.Invoke(nameof(IPopup.OnDismissedByTappingOutsideOfPopup));
- }
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.android.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.android.cs
deleted file mode 100644
index 64d6d462d1..0000000000
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.android.cs
+++ /dev/null
@@ -1,444 +0,0 @@
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using Android.Graphics.Drawables;
-using Android.Views;
-using CommunityToolkit.Maui.Core.Handlers;
-using Microsoft.Maui.Platform;
-using static Android.Views.ViewGroup;
-using AColorRes = Android.Resource.Color;
-using APoint = Android.Graphics.Point;
-using AView = Android.Views.View;
-using LayoutAlignment = Microsoft.Maui.Primitives.LayoutAlignment;
-
-namespace CommunityToolkit.Maui.Core.Views;
-
-///
-/// Extension class where Helper methods for Popup lives.
-///
-#if NET10_0_OR_GREATER
-#error Remove MauiPopup
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(PopupExtensions)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public static class PopupExtensions
-{
- ///
- /// Method to update the view.
- ///
- /// An instance of .
- /// An instance of .
- /// Width of Popup
- /// Height of Popup
- /// if the is null an exception will be thrown.
- public static void SetAnchor(this Dialog dialog, in IPopup popup, int? popupWidth = null, int? popupHeight = null)
- {
- var window = GetWindow(dialog);
-
- var windowManager = window.WindowManager;
- var statusBarHeight = GetStatusBarHeight(windowManager);
- var navigationBarHeight = GetNavigationBarHeight(windowManager);
- var windowSize = GetWindowSize(windowManager);
- var rotation = windowManager.DefaultDisplay?.Rotation ?? throw new InvalidOperationException("DefaultDisplay cannot be null");
- navigationBarHeight = windowSize.Height < windowSize.Width ? (rotation == SurfaceOrientation.Rotation270 ? navigationBarHeight : 0) : 0;
-
- if (popup.Handler?.MauiContext is null)
- {
- return;
- }
-
- if (popup.Anchor is not null)
- {
- var anchorView = popup.Anchor.ToPlatform();
-
- var locationOnScreen = new int[2];
- anchorView.GetLocationOnScreen(locationOnScreen);
- if (popupWidth is null && popupHeight is null)
- {
- window.DecorView.Measure((int)MeasureSpecMode.Unspecified, (int)MeasureSpecMode.Unspecified);
- }
-
- // This logic is tricky, please read these notes if you need to modify
- // Android window coordinate starts (0,0) at the top left and (max,max) at the bottom right. All of the positions
- // that are being handled in this operation assume the point is at the top left of the rectangle. This means the
- // calculation operates in this order:
- // 1. Calculate top-left position of Anchor
- // 2. Calculate the Actual Center of the Anchor by adding the width /2 and height / 2
- // 3. Calculate the top-left point of where the dialog should be positioned by subtracting the Width / 2 and height / 2
- // of the dialog that is about to be drawn.
- var attribute = window.Attributes ?? throw new InvalidOperationException($"{nameof(window.Attributes)} cannot be null");
-
- var newX = locationOnScreen[0] - navigationBarHeight + (anchorView.Width / 2) - (popupWidth == null ? (window.DecorView.Width / 2) : (int)(popupWidth / 2));
- var newY = locationOnScreen[1] - statusBarHeight + (anchorView.Height / 2) - (popupHeight == null ? (window.DecorView.Height / 2) : (int)(popupHeight / 2));
-
- if (!(newX == attribute.X &&
- newY == attribute.Y))
- {
- window.SetGravity(GravityFlags.Top | GravityFlags.Left);
- attribute.X = newX;
- attribute.Y = newY;
- window.Attributes = attribute;
- }
- }
- else
- {
- SetDialogPosition(popup, window);
- }
- }
-
- ///
- /// Method to update the property.
- ///
- /// An instance of .
- /// An instance of .
- public static void SetColor(this Dialog dialog, in IPopup popup)
- {
- if (popup.Color is null)
- {
- return;
- }
-
- var window = GetWindow(dialog);
- window.SetBackgroundDrawable(new ColorDrawable(popup.Color.ToPlatform(AColorRes.BackgroundLight, dialog.Context)));
- }
-
- ///
- /// Method to update the property.
- ///
- /// An instance of .
- /// An instance of .
- public static void SetCanBeDismissedByTappingOutsideOfPopup(this Dialog dialog, in IPopup popup)
- {
- dialog.SetCancelable(popup.CanBeDismissedByTappingOutsideOfPopup);
- dialog.SetCanceledOnTouchOutside(popup.CanBeDismissedByTappingOutsideOfPopup);
- }
-
- ///
- /// Method to update the property.
- ///
- /// An instance of .
- /// An instance of .
- /// The native representation of .
- /// An instance of .
- /// if the is null an exception will be thrown. If the is null an exception will be thrown.
- public static void SetSize(this Dialog dialog, in IPopup popup, in AView container, PopupHandler handler)
- {
- ArgumentNullException.ThrowIfNull(dialog);
- ArgumentNullException.ThrowIfNull(container);
- ArgumentNullException.ThrowIfNull(popup.Content);
- ArgumentNullException.ThrowIfNull(handler);
-
- var window = GetWindow(dialog);
- var context = dialog.Context;
- var windowManager = window.WindowManager;
-
- var decorView = (ViewGroup)window.DecorView;
-
- var windowSize = GetWindowSize(windowManager);
- int width = LayoutParams.WrapContent;
- int height = LayoutParams.WrapContent;
-
- if (popup.Size.IsZero)
- {
- if (double.IsNaN(popup.Content.Width) || double.IsNaN(popup.Content.Height))
- {
- if ((handler.LastPopupWidth == decorView.MeasuredWidth
- && handler.LastPopupHeight == decorView.MeasuredHeight)
- && Math.Abs(handler.LastWindowWidth - windowSize.Width) < 0.01 // Allow for floating point variation
- && Math.Abs(handler.LastWindowHeight - windowSize.Height) < 0.01) // Allow for floating point variation
- {
- SetAnchor(dialog, popup, handler.LastPopupWidth, handler.LastPopupHeight);
- return;
- }
-
- decorView.Measure(
- MeasureSpecMode.AtMost.MakeMeasureSpec((int)windowSize.Width),
- MeasureSpecMode.AtMost.MakeMeasureSpec((int)windowSize.Height)
- );
-
- if (double.IsNaN(popup.Content.Width))
- {
- if (popup.HorizontalOptions == LayoutAlignment.Fill)
- {
- width = (int)windowSize.Width;
- }
- else
- {
- if (decorView.MeasuredWidth >= windowSize.Width)
- {
- width = (int)windowSize.Width;
- }
- }
- }
- else
- {
- if (context.ToPixels(popup.Content.Width) >= windowSize.Width)
- {
- width = (int)windowSize.Width;
- }
- else
- {
- width = (int)context.ToPixels(popup.Content.Width);
- }
- }
-
- if (double.IsNaN(popup.Content.Height))
- {
- if (popup.VerticalOptions == LayoutAlignment.Fill)
- {
- height = (int)windowSize.Height;
- }
- else
- {
- if (decorView.MeasuredHeight >= windowSize.Height)
- {
- height = (int)windowSize.Height;
- }
- }
- }
- else
- {
- if (context.ToPixels(popup.Content.Height) >= windowSize.Height)
- {
- height = (int)windowSize.Height;
- }
- else
- {
- height = (int)context.ToPixels(popup.Content.Height);
- }
- }
-
- window.SetLayout(width, height);
-
- width = width == LayoutParams.WrapContent ? decorView.MeasuredWidth : width;
- height = height == LayoutParams.WrapContent ? decorView.MeasuredHeight : height;
- }
- else
- {
- width = (int)context.ToPixels(popup.Content.Width);
- height = (int)context.ToPixels(popup.Content.Height);
- width = width > windowSize.Width ? (int)windowSize.Width : width;
- height = height > windowSize.Height ? (int)windowSize.Height : height;
-
- if (handler.LastPopupWidth == width
- && handler.LastPopupHeight == height
- && Math.Abs(handler.LastWindowWidth - windowSize.Width) < 0.01 // Allow for floating point variation
- && Math.Abs(handler.LastWindowHeight - windowSize.Height) < 0.01)// Allow for floating point variation
- {
- SetAnchor(dialog, popup, handler.LastPopupWidth, handler.LastPopupHeight);
- return;
- }
-
- window.SetLayout(width, height);
-
- }
- }
- else
- {
- width = (int)context.ToPixels(popup.Size.Width);
- height = (int)context.ToPixels(popup.Size.Height);
- width = width > windowSize.Width ? (int)windowSize.Width : width;
- height = height > windowSize.Height ? (int)windowSize.Height : height;
-
- if (handler.LastPopupWidth == width
- && handler.LastPopupHeight == height
- && Math.Abs(handler.LastWindowWidth - windowSize.Width) < 0.01 // Allow for floating point variation
- && Math.Abs(handler.LastWindowHeight - windowSize.Height) < 0.01) // Allow for floating point variation
- {
- SetAnchor(dialog, popup, handler.LastPopupWidth, handler.LastPopupHeight);
- return;
- }
-
- window.SetLayout(width, height);
-
- }
-
- handler.LastPopupWidth = decorView.Width;
- handler.LastPopupHeight = decorView.Height;
- handler.LastWindowWidth = windowSize.Width;
- handler.LastWindowHeight = windowSize.Height;
-
- SetAnchor(dialog, popup, width, height);
- }
-
- static void SetDialogPosition(in IPopup popup, Window window)
- {
- var isFlowDirectionRightToLeft = popup.Content?.FlowDirection == FlowDirection.RightToLeft;
-
- var gravityFlags = popup.VerticalOptions switch
- {
- LayoutAlignment.Start => GravityFlags.Top,
- LayoutAlignment.End => GravityFlags.Bottom,
- LayoutAlignment.Center or LayoutAlignment.Fill => GravityFlags.CenterVertical,
- _ => throw new NotSupportedException($"{nameof(IPopup.VerticalOptions)}: {popup.VerticalOptions} is not yet supported")
- };
-
- gravityFlags |= popup.HorizontalOptions switch
- {
- LayoutAlignment.Start => isFlowDirectionRightToLeft ? GravityFlags.Right : GravityFlags.Left,
- LayoutAlignment.End => isFlowDirectionRightToLeft ? GravityFlags.Left : GravityFlags.Right,
- LayoutAlignment.Center or LayoutAlignment.Fill => GravityFlags.CenterHorizontal,
- _ => throw new NotSupportedException($"{nameof(IPopup.HorizontalOptions)}: {popup.HorizontalOptions} is not yet supported")
- };
-
- window.SetGravity(gravityFlags);
- }
-
- static Window GetWindow(in Dialog dialog) =>
- dialog.Window ?? throw new InvalidOperationException($"{nameof(Dialog)}.{nameof(Dialog.Window)} cannot be null");
-
- static Size GetWindowSize([NotNull] IWindowManager? windowManager)
- {
- ArgumentNullException.ThrowIfNull(windowManager);
-
- int windowWidth;
- int windowHeight;
- int statusBarHeight;
- int navigationBarHeight;
-
- if (OperatingSystem.IsAndroidVersionAtLeast(30))
- {
- var windowMetrics = windowManager.CurrentWindowMetrics;
- var windowInsets = windowMetrics.WindowInsets.GetInsetsIgnoringVisibility(WindowInsets.Type.SystemBars());
- windowWidth = windowMetrics.Bounds.Width();
- windowHeight = windowMetrics.Bounds.Height();
- statusBarHeight = windowInsets.Top;
- navigationBarHeight = windowHeight < windowWidth ? windowInsets.Left + windowInsets.Right : windowInsets.Bottom;
- }
- else if (windowManager.DefaultDisplay is null)
- {
- throw new InvalidOperationException($"{nameof(IWindowManager)}.{nameof(IWindowManager.DefaultDisplay)} cannot be null");
- }
- else
- {
- APoint realSize = new();
- APoint displaySize = new();
- APoint displaySmallSize = new();
- APoint displayLargeSize = new();
-
- windowManager.DefaultDisplay.GetRealSize(realSize);
- ArgumentNullException.ThrowIfNull(realSize);
-
- windowManager.DefaultDisplay.GetSize(displaySize);
- ArgumentNullException.ThrowIfNull(displaySize);
-
- windowManager.DefaultDisplay.GetCurrentSizeRange(displaySmallSize, displayLargeSize);
- ArgumentNullException.ThrowIfNull(displaySmallSize);
- ArgumentNullException.ThrowIfNull(displayLargeSize);
-
- windowWidth = realSize.X;
- windowHeight = realSize.Y;
-
- if (displaySize.X > displaySize.Y)
- {
- statusBarHeight = displaySize.Y - displaySmallSize.Y;
- }
- else
- {
- statusBarHeight = displaySize.Y - displayLargeSize.Y;
- }
-
- navigationBarHeight = realSize.Y < realSize.X
- ? (realSize.X - displaySize.X)
- : (realSize.Y - displaySize.Y);
- }
-
- windowWidth -= windowHeight < windowWidth
- ? navigationBarHeight
- : 0;
-
- windowHeight -= (windowHeight < windowWidth
- ? 0
- : navigationBarHeight)
- + statusBarHeight;
-
- return new Size(windowWidth, windowHeight);
- }
-
- static int GetNavigationBarHeight(IWindowManager? windowManager)
- {
- ArgumentNullException.ThrowIfNull(windowManager);
-
- int navigationBarHeight;
-
- if (OperatingSystem.IsAndroidVersionAtLeast(30))
- {
- var windowMetrics = windowManager.CurrentWindowMetrics;
- var windowInsets = windowMetrics.WindowInsets.GetInsetsIgnoringVisibility(WindowInsets.Type.SystemBars());
- var windowWidth = windowMetrics.Bounds.Width();
- var windowHeight = windowMetrics.Bounds.Height();
- navigationBarHeight = windowHeight < windowWidth ? windowInsets.Left + windowInsets.Right : windowInsets.Bottom;
- }
- else if (windowManager.DefaultDisplay is null)
- {
- throw new InvalidOperationException($"{nameof(IWindowManager)}.{nameof(IWindowManager.DefaultDisplay)} cannot be null");
- }
- else
- {
- APoint realSize = new();
- APoint displaySize = new();
- APoint displaySmallSize = new();
- APoint displayLargeSize = new();
-
- windowManager.DefaultDisplay.GetRealSize(realSize);
- ArgumentNullException.ThrowIfNull(realSize);
-
- windowManager.DefaultDisplay.GetSize(displaySize);
- ArgumentNullException.ThrowIfNull(displaySize);
-
- windowManager.DefaultDisplay.GetCurrentSizeRange(displaySmallSize, displayLargeSize);
- ArgumentNullException.ThrowIfNull(displaySmallSize);
- ArgumentNullException.ThrowIfNull(displayLargeSize);
-
- navigationBarHeight = realSize.Y < realSize.X
- ? (realSize.X - displaySize.X)
- : (realSize.Y - displaySize.Y);
- }
-
- return navigationBarHeight;
- }
-
- static int GetStatusBarHeight(IWindowManager? windowManager)
- {
- ArgumentNullException.ThrowIfNull(windowManager);
-
- int statusBarHeight;
-
- if (OperatingSystem.IsAndroidVersionAtLeast(30))
- {
- var windowMetrics = windowManager.CurrentWindowMetrics;
- var windowInsets = windowMetrics.WindowInsets.GetInsetsIgnoringVisibility(WindowInsets.Type.SystemBars());
- statusBarHeight = windowInsets.Top;
- }
- else if (windowManager.DefaultDisplay is null)
- {
- throw new InvalidOperationException($"{nameof(IWindowManager)}.{nameof(IWindowManager.DefaultDisplay)} cannot be null");
- }
- else
- {
- APoint realSize = new();
- APoint displaySize = new();
- APoint displaySmallSize = new();
- APoint displayLargeSize = new();
-
- windowManager.DefaultDisplay.GetRealSize(realSize);
- ArgumentNullException.ThrowIfNull(realSize);
-
- windowManager.DefaultDisplay.GetSize(displaySize);
- ArgumentNullException.ThrowIfNull(displaySize);
-
- windowManager.DefaultDisplay.GetCurrentSizeRange(displaySmallSize, displayLargeSize);
- ArgumentNullException.ThrowIfNull(displaySmallSize);
- ArgumentNullException.ThrowIfNull(displayLargeSize);
-
- if (displaySize.X > displaySize.Y)
- {
- statusBarHeight = displaySize.Y - displaySmallSize.Y;
- }
- else
- {
- statusBarHeight = displaySize.Y - displayLargeSize.Y;
- }
- }
-
- return statusBarHeight;
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
deleted file mode 100644
index dd14e0d74c..0000000000
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
+++ /dev/null
@@ -1,255 +0,0 @@
-using System.ComponentModel;
-using Microsoft.Maui.Platform;
-using ObjCRuntime;
-
-namespace CommunityToolkit.Maui.Core.Views;
-///
-/// Extension class where Helper methods for Popup lives.
-///
-#if NET10_0_OR_GREATER
-#error Remove PopupExtensions
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(PopupExtensions)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public static class PopupExtensions
-{
- static readonly nfloat defaultPopoverLayoutMargin = 0.0001f;
-
-#if MACCATALYST
- // https://github.com/CommunityToolkit/Maui/pull/1361#issuecomment-1736487174
- static nfloat popupMargin = 18f;
-#endif
-
-
- ///
- /// Method to update the of the Popup.
- ///
- /// An instance of .
- /// An instance of .
- public static void SetSize(this MauiPopup mauiPopup, in IPopup popup)
- {
- ArgumentNullException.ThrowIfNull(popup.Content);
-
- CGRect frame;
-
- if (mauiPopup.ViewController?.View?.Window is UIWindow window)
- {
- frame = window.Frame;
- }
- else
- {
- frame = UIScreen.MainScreen.Bounds;
- }
-
- CGSize currentSize;
-
- if (popup.Size.IsZero)
- {
- if (double.IsNaN(popup.Content.Width) || double.IsNaN(popup.Content.Height))
- {
- var content = popup.Content.ToPlatform(popup.Handler?.MauiContext ?? throw new InvalidOperationException($"{nameof(popup.Handler.MauiContext)} Cannot Be Null"));
- var contentSize = content.SizeThatFits(new CGSize(double.IsNaN(popup.Content.Width) ? frame.Width : popup.Content.Width, double.IsNaN(popup.Content.Height) ? frame.Height : popup.Content.Height));
- var width = contentSize.Width;
- var height = contentSize.Height;
-
- if (double.IsNaN(popup.Content.Width))
- {
- width = popup.HorizontalOptions == Microsoft.Maui.Primitives.LayoutAlignment.Fill ? frame.Size.Width : width;
- }
- if (double.IsNaN(popup.Content.Height))
- {
- height = popup.VerticalOptions == Microsoft.Maui.Primitives.LayoutAlignment.Fill ? frame.Size.Height : height;
- }
-
- currentSize = new CGSize(width, height);
- }
- else
- {
- currentSize = new CGSize(popup.Content.Width, popup.Content.Height);
- }
- }
- else
- {
- currentSize = new CGSize(popup.Size.Width, popup.Size.Height);
- }
-
-#if MACCATALYST
- currentSize.Width = NMath.Min(currentSize.Width, frame.Size.Width - defaultPopoverLayoutMargin * 2 - popupMargin * 2);
- currentSize.Height = NMath.Min(currentSize.Height, frame.Size.Height - defaultPopoverLayoutMargin * 2 - popupMargin * 2);
-#else
- currentSize.Width = NMath.Min(currentSize.Width, frame.Size.Width);
- currentSize.Height = NMath.Min(currentSize.Height, frame.Size.Height);
-#endif
- mauiPopup.PreferredContentSize = currentSize;
- }
-
- ///
- /// Method to update the of the Popup.
- ///
- /// An instance of .
- /// An instance of .
- public static void SetBackgroundColor(this MauiPopup mauiPopup, in IPopup popup)
- {
- if (mauiPopup.PopoverPresentationController is not null && Equals(popup.Color, Colors.Transparent))
- {
- mauiPopup.PopoverPresentationController.PopoverBackgroundViewType = typeof(TransparentPopoverBackgroundView);
- }
-
- if (mauiPopup.Control is null)
- {
- return;
- }
-
- var color = popup.Color?.ToPlatform();
- mauiPopup.Control.PlatformView.BackgroundColor = color;
-
- if (mauiPopup.Control.ViewController?.View is UIView view)
- {
- view.BackgroundColor = color;
- }
- }
-
- ///
- /// Method to update the property of the Popup.
- ///
- /// An instance of .
- /// An instance of .
- public static void SetCanBeDismissedByTappingOutsideOfPopup(this MauiPopup mauiPopup, in IPopup popup)
- {
- if (OperatingSystem.IsIOSVersionAtLeast(13))
- {
- mauiPopup.ModalInPresentation = !popup.CanBeDismissedByTappingOutsideOfPopup;
- }
- }
-
- ///
- /// Method to update the layout of the Popup and .
- ///
- /// An instance of .
- /// An instance of .
- public static void SetLayout(this MauiPopup mauiPopup, in IPopup popup)
- {
- if (mauiPopup.View is null)
- {
- return;
- }
-
- CGRect frame;
-
- if (mauiPopup.ViewController?.View?.Window is UIWindow window)
- {
- frame = window.Frame;
- }
- else
- {
- frame = UIScreen.MainScreen.Bounds;
- }
-
- if (mauiPopup.PopoverPresentationController is null)
- {
- throw new InvalidOperationException("PopoverPresentationController cannot be null");
- }
-
-#if MACCATALYST
- var titleBarHeight = mauiPopup.ViewController?.NavigationController?.NavigationBar.Frame.Y ?? 0;
- var navigationBarHeight = mauiPopup.ViewController?.NavigationController?.NavigationBar.Frame.Size.Height ?? 0;
-#endif
-
- if (popup.Anchor is null)
- {
- var isFlowDirectionRightToLeft = popup.Content?.FlowDirection == FlowDirection.RightToLeft;
- var horizontalOptionsPositiveNegativeMultiplier = isFlowDirectionRightToLeft ? (nfloat)(-1) : (nfloat)1;
-
- nfloat originY;
- if (mauiPopup.PreferredContentSize.Height < frame.Height)
- {
- originY = popup.VerticalOptions switch
- {
-#if MACCATALYST
- Microsoft.Maui.Primitives.LayoutAlignment.Start => mauiPopup.PreferredContentSize.Height / 2 - (titleBarHeight + navigationBarHeight - popupMargin),
- Microsoft.Maui.Primitives.LayoutAlignment.End => frame.Height - mauiPopup.PreferredContentSize.Height / 2 - (titleBarHeight + navigationBarHeight + popupMargin),
- Microsoft.Maui.Primitives.LayoutAlignment.Center or Microsoft.Maui.Primitives.LayoutAlignment.Fill => frame.GetMidY() - (titleBarHeight + navigationBarHeight),
-#else
- Microsoft.Maui.Primitives.LayoutAlignment.Start => mauiPopup.PreferredContentSize.Height / 2,
- Microsoft.Maui.Primitives.LayoutAlignment.End => frame.Height - (mauiPopup.PreferredContentSize.Height / 2),
- Microsoft.Maui.Primitives.LayoutAlignment.Center or Microsoft.Maui.Primitives.LayoutAlignment.Fill => frame.GetMidY(),
-#endif
- _ => throw new NotSupportedException($"{nameof(Microsoft.Maui.Primitives.LayoutAlignment)} {popup.VerticalOptions} is not yet supported")
- };
- }
- else
- {
- originY = -frame.GetMidY();
- }
-
- nfloat originX;
- if (mauiPopup.PreferredContentSize.Width < frame.Width)
- {
- originX = popup.HorizontalOptions switch
- {
-#if MACCATALYST
- Microsoft.Maui.Primitives.LayoutAlignment.Start => (frame.Width - frame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - (mauiPopup.PreferredContentSize.Width - mauiPopup.PreferredContentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - (popupMargin - popupMargin * horizontalOptionsPositiveNegativeMultiplier),
- Microsoft.Maui.Primitives.LayoutAlignment.End => (frame.Width + frame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - (mauiPopup.PreferredContentSize.Width + mauiPopup.PreferredContentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - (popupMargin + popupMargin * horizontalOptionsPositiveNegativeMultiplier),
- Microsoft.Maui.Primitives.LayoutAlignment.Center or Microsoft.Maui.Primitives.LayoutAlignment.Fill => frame.GetMidX() - mauiPopup.PreferredContentSize.Width / 2 - popupMargin,
-#else
- Microsoft.Maui.Primitives.LayoutAlignment.Start => (frame.Width - frame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - (mauiPopup.PreferredContentSize.Width / 2 - mauiPopup.PreferredContentSize.Width / 2 * horizontalOptionsPositiveNegativeMultiplier) / 2,
- Microsoft.Maui.Primitives.LayoutAlignment.End => (frame.Width + frame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - (mauiPopup.PreferredContentSize.Width / 2 + mauiPopup.PreferredContentSize.Width / 2 * horizontalOptionsPositiveNegativeMultiplier) / 2,
- Microsoft.Maui.Primitives.LayoutAlignment.Center or Microsoft.Maui.Primitives.LayoutAlignment.Fill => frame.GetMidX(),
-#endif
- _ => throw new NotSupportedException($"{nameof(Microsoft.Maui.Primitives.LayoutAlignment)} {popup.VerticalOptions} is not yet supported")
- };
- }
- else
- {
- originX = -frame.GetMidX();
- }
-
- if (mauiPopup.ViewController?.PopoverPresentationController is UIPopoverPresentationController popoverPresentationController)
- {
- mauiPopup.PopoverPresentationController.SourceView = popoverPresentationController.SourceView;
- }
- mauiPopup.PopoverPresentationController.SourceRect = new CGRect(originX, originY, 0, 0);
- mauiPopup.PopoverPresentationController.PermittedArrowDirections = 0;
- // From the point of view of usability, the top, bottom, left, and right values of UIEdgeInsets cannot all be 0.
- // If you specify 0 for the top, bottom, left, and right of UIEdgeInsets, the default margins will be added, so
- // specify a value as close to 0 here as possible.
- mauiPopup.PopoverPresentationController.PopoverLayoutMargins = new UIEdgeInsets(defaultPopoverLayoutMargin, defaultPopoverLayoutMargin, defaultPopoverLayoutMargin, defaultPopoverLayoutMargin);
- }
- else
- {
- var view = popup.Anchor.ToPlatform(popup.Handler?.MauiContext ?? throw new InvalidOperationException($"{nameof(popup.Handler.MauiContext)} Cannot Be Null"));
- mauiPopup.PopoverPresentationController.SourceView = view;
- mauiPopup.PopoverPresentationController.SourceRect = view.Bounds;
- }
- }
-
- sealed class TransparentPopoverBackgroundView : UIPopoverBackgroundView
- {
- public TransparentPopoverBackgroundView(IntPtr handle) : base(handle)
- {
- BackgroundColor = Colors.Transparent.ToPlatform();
- Alpha = 0.0f;
- }
-
- public override nfloat ArrowOffset { get; set; }
-
- public override UIPopoverArrowDirection ArrowDirection { get; set; }
-
- [Export("arrowHeight")]
- static new float GetArrowHeight()
- {
- return 0f;
- }
-
- [Export("arrowBase")]
- static new float GetArrowBase()
- {
- return 0f;
- }
-
- [Export("contentViewInsets")]
- static new UIEdgeInsets GetContentViewInsets()
- {
- return UIEdgeInsets.Zero;
- }
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.windows.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.windows.cs
deleted file mode 100644
index 1bf50b9f24..0000000000
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.windows.cs
+++ /dev/null
@@ -1,270 +0,0 @@
-using System.ComponentModel;
-using CommunityToolkit.Maui.Core.Handlers;
-using Microsoft.Maui.Platform;
-using Microsoft.Maui.Primitives;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-
-namespace CommunityToolkit.Maui.Core.Views;
-
-///
-/// Extension class where Helper methods for Popup lives.
-///
-#if NET10_0_OR_GREATER
-#error Remove PopupExtensions
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(PopupExtensions)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-public static class PopupExtensions
-{
- ///
- /// Method to update the based on the .
- ///
- /// An instance of .
- /// An instance of .
- public static void SetColor(this Popup mauiPopup, IPopup popup)
- {
- ArgumentNullException.ThrowIfNull(popup.Content);
-
- var color = popup.Color ?? Colors.Transparent;
- if (mauiPopup.Child is Panel panel)
- {
- panel.Background = color.ToPlatform();
- }
- }
-
- ///
- /// Method to update the popup anchor based on the .
- ///
- /// An instance of .
- /// An instance of .
- /// An instance of .
- public static void SetAnchor(this Popup mauiPopup, IPopup popup, IMauiContext? mauiContext)
- {
- ArgumentNullException.ThrowIfNull(mauiContext);
- mauiPopup.PlacementTarget = popup.Anchor?.ToPlatform(mauiContext);
- }
-
- ///
- /// Method to prepare control.
- ///
- /// An instance of .
- /// An instance of .
- /// An instance of .
- public static void ConfigureControl(this Popup mauiPopup, IPopup popup, IMauiContext? mauiContext)
- {
- ArgumentNullException.ThrowIfNull(mauiContext);
- if (popup.Content is not null && popup.Handler is PopupHandler handler)
- {
- mauiPopup.Child = handler.VirtualView.Content?.ToPlatform(mauiContext);
- }
-
- mauiPopup.SetSize(popup, mauiContext);
- mauiPopup.SetLayout(popup, mauiContext);
- }
-
- ///
- /// Method to update the popup size based on the .
- ///
- /// An instance of .
- /// An instance of .
- /// An instance of .
- public static void SetSize(this Popup mauiPopup, IPopup popup, IMauiContext? mauiContext)
- {
- ArgumentNullException.ThrowIfNull(mauiContext);
- ArgumentNullException.ThrowIfNull(popup.Content);
-
- const double defaultBorderThickness = 0;
- const double defaultSize = 600;
-
- var popupParent = mauiContext.GetPlatformWindow();
- var currentSize = new Size { Width = defaultSize, Height = defaultSize / 2 };
-
- if (popup.Size.IsZero)
- {
- if (double.IsNaN(popup.Content.Width) || (double.IsNaN(popup.Content.Height)))
- {
- currentSize = popup.Content.Measure(double.IsNaN(popup.Content.Width) ? popupParent.Bounds.Width : popup.Content.Width, double.IsNaN(popup.Content.Height) ? popupParent.Bounds.Height : popup.Content.Height);
-
- if (double.IsNaN(popup.Content.Width))
- {
- currentSize.Width = popup.HorizontalOptions == LayoutAlignment.Fill ? popupParent.Bounds.Width : currentSize.Width;
- }
- if (double.IsNaN(popup.Content.Height))
- {
- currentSize.Height = popup.VerticalOptions == LayoutAlignment.Fill ? popupParent.Bounds.Height : currentSize.Height;
- }
- }
- else
- {
- currentSize.Width = popup.Content.Width;
- currentSize.Height = popup.Content.Height;
- }
- }
- else
- {
- currentSize.Width = popup.Size.Width;
- currentSize.Height = popup.Size.Height;
- }
-
- currentSize.Width = Math.Min(currentSize.Width, popupParent.Bounds.Width);
- currentSize.Height = Math.Min(currentSize.Height, popupParent.Bounds.Height);
-
- mauiPopup.Width = currentSize.Width;
- mauiPopup.Height = currentSize.Height;
- mauiPopup.MinWidth = mauiPopup.MaxWidth = currentSize.Width + (defaultBorderThickness * 2);
- mauiPopup.MinHeight = mauiPopup.MaxHeight = currentSize.Height + (defaultBorderThickness * 2);
-
- if (mauiPopup.Child is FrameworkElement control)
- {
- control.Width = mauiPopup.Width;
- control.Height = mauiPopup.Height;
- }
- }
-
- ///
- /// Method to update the popup layout.
- ///
- /// An instance of .
- /// An instance of .
- /// An instance of .
- public static void SetLayout(this Popup mauiPopup, IPopup popup, IMauiContext? mauiContext)
- {
- ArgumentNullException.ThrowIfNull(mauiContext);
- ArgumentNullException.ThrowIfNull(popup.Content);
-
- var popupParent = mauiContext.GetPlatformWindow();
- popup.Content.Measure(double.PositiveInfinity, double.PositiveInfinity);
- var contentSize = popup.Content.ToPlatform(mauiContext).DesiredSize;
- var popupParentFrame = popupParent.Bounds;
-
- var isFlowDirectionRightToLeft = popup.Content?.FlowDirection == Microsoft.Maui.FlowDirection.RightToLeft;
- var horizontalOptionsPositiveNegativeMultiplier = isFlowDirectionRightToLeft ? -1 : 1;
-
- var verticalOptions = popup.VerticalOptions;
- var horizontalOptions = popup.HorizontalOptions;
- if (popup.Anchor is not null)
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Top;
- }
- else if (IsTopLeft(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.TopEdgeAlignedLeft;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = 0;
- }
- else if (IsTop(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Top;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = 0;
- }
- else if (IsTopRight(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.TopEdgeAlignedRight;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width + popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier;
- mauiPopup.VerticalOffset = 0;
- }
- else if (IsRight(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Right;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width + popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else if (IsBottomRight(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.BottomEdgeAlignedRight;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width + popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier;
- mauiPopup.VerticalOffset = popupParentFrame.Height - contentSize.Height;
- }
- else if (IsBottom(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Bottom;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = popupParentFrame.Height - contentSize.Height;
- }
- else if (IsBottomLeft(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.BottomEdgeAlignedLeft;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = popupParentFrame.Height - contentSize.Height;
- }
- else if (IsLeft(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Left;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else if (IsCenter(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else if (IsFillLeft(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else if (IsFillCenter(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else if (IsFillRight(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width + popupParentFrame.Width * horizontalOptionsPositiveNegativeMultiplier) / 2 - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else if (IsTopFill(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = 0;
- }
- else if (IsCenterFill(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else if (IsBottomFill(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = popupParentFrame.Height - contentSize.Height;
- }
- else if (IsFill(verticalOptions, horizontalOptions))
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
- else
- {
- mauiPopup.DesiredPlacement = PopupPlacementMode.Auto;
- mauiPopup.HorizontalOffset = (popupParentFrame.Width - contentSize.Width * horizontalOptionsPositiveNegativeMultiplier) / 2;
- mauiPopup.VerticalOffset = (popupParentFrame.Height - contentSize.Height) / 2;
- }
-
- static bool IsTopLeft(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Start && horizontalOptions == LayoutAlignment.Start;
- static bool IsTop(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Start && horizontalOptions == LayoutAlignment.Center;
- static bool IsTopRight(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Start && horizontalOptions == LayoutAlignment.End;
- static bool IsRight(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Center && horizontalOptions == LayoutAlignment.End;
- static bool IsBottomRight(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.End && horizontalOptions == LayoutAlignment.End;
- static bool IsBottom(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.End && horizontalOptions == LayoutAlignment.Center;
- static bool IsBottomLeft(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.End && horizontalOptions == LayoutAlignment.Start;
- static bool IsLeft(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Center && horizontalOptions == LayoutAlignment.Start;
- static bool IsCenter(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Center && horizontalOptions == LayoutAlignment.Center;
- static bool IsFillLeft(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Fill && horizontalOptions == LayoutAlignment.Start;
- static bool IsFillCenter(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Fill && horizontalOptions == LayoutAlignment.Center;
- static bool IsFillRight(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Fill && horizontalOptions == LayoutAlignment.End;
- static bool IsTopFill(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Start && horizontalOptions == LayoutAlignment.Fill;
- static bool IsCenterFill(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Center && horizontalOptions == LayoutAlignment.Fill;
- static bool IsBottomFill(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.End && horizontalOptions == LayoutAlignment.Fill;
- static bool IsFill(LayoutAlignment verticalOptions, LayoutAlignment horizontalOptions) => verticalOptions == LayoutAlignment.Fill && horizontalOptions == LayoutAlignment.Fill;
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupOverlay.windows.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupOverlay.windows.cs
deleted file mode 100644
index a72d4896d5..0000000000
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupOverlay.windows.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System.ComponentModel;
-namespace CommunityToolkit.Maui.Core.Views;
-
-///
-/// Displays Overlay in the Popup background.
-///
-#if NET10_0_OR_GREATER
-#error Remove PopupOverlay
-#endif
-[EditorBrowsable(EditorBrowsableState.Never), Obsolete($"{nameof(PopupOverlay)} is no longer used by {nameof(CommunityToolkit)}.{nameof(Maui)} and will be removed in .NET 10")]
-class PopupOverlay : WindowOverlay
-{
- readonly IWindowOverlayElement popupOverlayElement;
-
- ///
- /// Instantiates a new instance of .
- ///
- /// An instance of .
- /// Popup overlay color
- public PopupOverlay(IWindow window, Color? overlayColor = null) : base(window)
- {
- popupOverlayElement = new PopupOverlayElement(this, overlayColor);
-
- AddWindowElement(popupOverlayElement);
-
- EnableDrawableTouchHandling = true;
- }
-
- class PopupOverlayElement : IWindowOverlayElement
- {
- readonly IWindowOverlay overlay;
- readonly Color overlayColor = Color.FromRgba(255, 255, 255, 153); // 60% Opacity
-
- RectF overlayRect = new();
-
- public PopupOverlayElement(IWindowOverlay overlay, Color? overlayColor = null)
- {
- this.overlay = overlay;
- if (overlayColor is not null)
- {
- this.overlayColor = overlayColor;
- }
- }
-
- public bool Contains(Point point)
- {
- return overlayRect.Contains(new Point(point.X / overlay.Density, point.Y / overlay.Density));
- }
-
- public void Draw(ICanvas canvas, RectF dirtyRect)
- {
- overlayRect = dirtyRect;
- canvas.FillColor = overlayColor;
- canvas.FillRectangle(dirtyRect.X, dirtyRect.Y, dirtyRect.Width, dirtyRect.Height);
- }
- }
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj b/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj
index 3049d75301..8931d7e343 100644
--- a/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj
+++ b/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj
@@ -7,6 +7,7 @@
true
true
true
+ true
true
@@ -50,8 +51,8 @@
-
-
+
+
diff --git a/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj b/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj
index 26f3593580..5670a169e0 100644
--- a/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj
+++ b/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj b/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
index d7c2282f54..dc2f509b05 100644
--- a/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs b/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs
index 3f7eb88638..57a0d3c49f 100644
--- a/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs
@@ -2,6 +2,7 @@
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Handlers;
using CommunityToolkit.Maui.Views;
+using Microsoft.Maui.Hosting;
namespace CommunityToolkit.Maui;
diff --git a/src/CommunityToolkit.Maui.MediaElement/AssemblyInfo.shared.cs b/src/CommunityToolkit.Maui.MediaElement/AssemblyInfo.shared.cs
index 5e4f0ffdb0..821ab6a56c 100644
--- a/src/CommunityToolkit.Maui.MediaElement/AssemblyInfo.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/AssemblyInfo.shared.cs
@@ -1,8 +1,9 @@
-[assembly: XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Converters))]
-[assembly: XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Core))]
-[assembly: XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Core.Handlers))]
-[assembly: XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Core.Views))]
-[assembly: XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Views))]
+
+[assembly:Microsoft.Maui.Controls.XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Converters))]
+[assembly: Microsoft.Maui.Controls.XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Core))]
+[assembly: Microsoft.Maui.Controls.XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Core.Handlers))]
+[assembly: Microsoft.Maui.Controls.XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Core.Views))]
+[assembly: Microsoft.Maui.Controls.XmlnsDefinition(Constants.XamlNamespace, Constants.CommunityToolkitNamespacePrefix + nameof(CommunityToolkit.Maui.Views))]
[assembly: Microsoft.Maui.Controls.XmlnsPrefix(Constants.XamlNamespace, "toolkit")]
diff --git a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
index 3967c221ad..63a476189c 100644
--- a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
+++ b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
@@ -8,6 +8,7 @@
true
true
true
+ true
15.0
@@ -59,13 +60,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -73,7 +74,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs
index 8d285d3610..12d37aaa56 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
+using Microsoft.Maui.Controls;
namespace CommunityToolkit.Maui.Extensions;
static class ElementExtensions
diff --git a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.shared.cs
index 80f66de283..0838febf93 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.shared.cs
@@ -1,3 +1,4 @@
+using Microsoft.Maui.Controls;
namespace CommunityToolkit.Maui.Extensions;
// Since MediaElement can't access .NET MAUI internals we have to copy this code here
diff --git a/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.shared.cs
index 62a9d8e8a4..00cc22a626 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.shared.cs
@@ -1,5 +1,6 @@
using CommunityToolkit.Maui.Core.Views;
using CommunityToolkit.Maui.Views;
+using Microsoft.Maui;
namespace CommunityToolkit.Maui.Core.Handlers;
diff --git a/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.windows.cs
index bbc29f0064..ae6fbf8b42 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.windows.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.windows.cs
@@ -1,6 +1,7 @@
using CommunityToolkit.Maui.Core.Views;
using CommunityToolkit.Maui.Views;
using Microsoft.Maui.Handlers;
+using Microsoft.Maui.Dispatching;
namespace CommunityToolkit.Maui.Core.Handlers;
diff --git a/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs
index a8f7ea3ebb..41334f086c 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.shared.cs
@@ -1,4 +1,5 @@
using CommunityToolkit.Maui.Views;
+using Microsoft.Maui;
namespace CommunityToolkit.Maui.Core;
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs
index 6d663135f2..555e5791fe 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs
@@ -1,6 +1,9 @@
using System.ComponentModel;
using CommunityToolkit.Maui.Converters;
using CommunityToolkit.Maui.Core;
+using Microsoft.Maui.Controls;
+using Microsoft.Maui;
+using Microsoft.Maui.Dispatching;
namespace CommunityToolkit.Maui.Views;
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaElementOptions.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaElementOptions.shared.cs
index 48ae9649c7..59c22d3ceb 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaElementOptions.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaElementOptions.shared.cs
@@ -1,4 +1,8 @@
-namespace CommunityToolkit.Maui.Core;
+using Microsoft.Maui;
+using Microsoft.Maui.Hosting;
+using CommunityToolkit.Maui.Core.Views;
+
+namespace CommunityToolkit.Maui.Core;
///
/// Construction options for MediaElement, for example, to create an Android SurfaceView or TextureView
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs
index 8a83771a42..83347801e9 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs
@@ -1,4 +1,5 @@
using System.ComponentModel;
+using Microsoft.Maui.Controls;
using CommunityToolkit.Maui.Converters;
namespace CommunityToolkit.Maui.Views;
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs
index 9d716e9f87..c12e414a88 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs
@@ -1,4 +1,6 @@
using System.ComponentModel;
+using Microsoft.Maui.Controls;
+using Microsoft.Maui;
using CommunityToolkit.Maui.Converters;
namespace CommunityToolkit.Maui.Views;
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs
index 8314c160b2..dde9a69432 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs
@@ -1,4 +1,5 @@
using System.ComponentModel;
+using Microsoft.Maui.Controls;
using CommunityToolkit.Maui.Converters;
namespace CommunityToolkit.Maui.Views;
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs
index c05c97df93..a7c4143069 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs
@@ -1,4 +1,5 @@
using System.ComponentModel;
+using Microsoft.Maui.Controls;
using UriTypeConverter = Microsoft.Maui.Controls.UriTypeConverter;
namespace CommunityToolkit.Maui.Views;
diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.windows.cs
index 47180da2e7..3056d6644a 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.windows.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.windows.cs
@@ -1,4 +1,5 @@
using Windows.Media;
+using Microsoft.Maui.Dispatching;
namespace CommunityToolkit.Maui.Core.Primitives;
diff --git a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
index db27fa8054..c1b6de91d3 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
@@ -111,7 +111,7 @@ public void SetLegacyNotifications(in MediaSession session, in PlatformMediaElem
playerNotificationManager.SetColor(Resource.Color.abc_primary_text_material_dark);
playerNotificationManager.SetUsePreviousActionInCompactView(true);
playerNotificationManager.SetVisibility(NotificationCompat.VisibilityPublic);
- playerNotificationManager.SetMediaSessionToken(session.SessionCompatToken);
+ playerNotificationManager.SetMediaSessionToken(session.PlatformToken);
playerNotificationManager.SetPlayer(mediaElement);
playerNotificationManager.SetColorized(true);
playerNotificationManager.SetShowPlayButtonIfPlaybackIsSuppressed(true);
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.tizen.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.tizen.cs
index a0495f3c04..4222b5bdc7 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.tizen.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.tizen.cs
@@ -1,13 +1,12 @@
using CommunityToolkit.Maui.Views;
using Tizen.NUI.BaseComponents;
-using Tizen.UIExtensions.NUI;
namespace CommunityToolkit.Maui.Core.Views;
///
/// The user-interface element that represents the on Tizen.
///
-public class MauiMediaElement : ViewGroup
+public class MauiMediaElement : Tizen.NUI.BaseComponents.View
{
VideoView videoView;
@@ -18,7 +17,7 @@ public class MauiMediaElement : ViewGroup
public MauiMediaElement(VideoView videoView)
{
this.videoView = videoView;
- Children.Add(videoView);
+ Add(videoView);
}
///
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
index 42e706bf00..a43ec8e973 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs
@@ -3,6 +3,8 @@
using CommunityToolkit.Maui.Extensions;
using CommunityToolkit.Maui.Primitives;
using CommunityToolkit.Maui.Views;
+using Microsoft.Maui.Controls;
+using Microsoft.Maui.Devices;
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
index 195537fb62..e4beddcf16 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
@@ -11,6 +11,11 @@
#endif
using Microsoft.Extensions.Logging;
+using Microsoft.Maui;
+using System;
+using Microsoft.Maui.Dispatching;
+using Microsoft.Maui.Controls;
+using Microsoft.Extensions.DependencyInjection;
namespace CommunityToolkit.Maui.Core.Views;
@@ -25,7 +30,7 @@ public partial class MediaManager
/// This application's .
/// The instance that is managed through this class.
/// The instance that allows propagation to the main thread.
- public MediaManager(IMauiContext context, IMediaElement mediaElement, IDispatcher dispatcher)
+ public MediaManager(Microsoft.Maui.IMauiContext context, IMediaElement mediaElement, IDispatcher dispatcher)
{
ArgumentNullException.ThrowIfNull(context);
ArgumentNullException.ThrowIfNull(mediaElement);
@@ -46,12 +51,12 @@ public MediaManager(IMauiContext context, IMediaElement mediaElement, IDispatche
///
/// The used by this class.
///
- protected IMauiContext MauiContext { get; }
+ protected Microsoft.Maui.IMauiContext MauiContext { get; }
///
/// The that allows propagation to the main thread
///
- protected IDispatcher Dispatcher { get; }
+ protected Microsoft.Maui.Dispatching.IDispatcher Dispatcher { get; }
///
/// Gets the instance for logging purposes.
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.windows.cs
index 39fe2aebb1..c1761bcc59 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.windows.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.windows.cs
@@ -4,6 +4,9 @@
using CommunityToolkit.Maui.Extensions;
using CommunityToolkit.Maui.Views;
using Microsoft.Extensions.Logging;
+using Microsoft.Maui;
+using Microsoft.Maui.Controls;
+using Microsoft.Maui.Dispatching;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Imaging;
using Windows.Media;
diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj b/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
index 0db4d21732..b1d5d63347 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
+++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj b/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
index ff45c781e1..b6648742e9 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
+++ b/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
index 72575d466a..1223da88ff 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
@@ -296,7 +296,7 @@ public void ILineHeightElementOnLineHeightChanged()
{
// For code coverage
var avatarView = new Maui.Views.AvatarView();
- ((Microsoft.Maui.Controls.Internals.ILineHeightElement)avatarView).OnLineHeightChanged(0.0, 3.7);
+ ((ILineHeightElement)avatarView).OnLineHeightChanged(0.0, 3.7);
avatarView.Text.Should().Be("?");
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj
index 3b43020049..d681fe30d2 100644
--- a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj
+++ b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj
@@ -7,6 +7,7 @@
true
true
true
+ true