summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.MacOS/Renderers/PageControllerDelegate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Renderers/PageControllerDelegate.cs')
-rw-r--r--Xamarin.Forms.Platform.MacOS/Renderers/PageControllerDelegate.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Renderers/PageControllerDelegate.cs b/Xamarin.Forms.Platform.MacOS/Renderers/PageControllerDelegate.cs
new file mode 100644
index 0000000..d1f40d3
--- /dev/null
+++ b/Xamarin.Forms.Platform.MacOS/Renderers/PageControllerDelegate.cs
@@ -0,0 +1,30 @@
+´╗┐using AppKit;
+using Foundation;
+
+namespace Xamarin.Forms.Platform.MacOS
+{
+ internal class PageControllerDelegate : NSPageControllerDelegate
+ {
+ public override string GetIdentifier(NSPageController pageController, NSObject targetObject)
+ {
+ return nameof(PageRenderer);
+ }
+
+ public override NSViewController GetViewController(NSPageController pageController, string identifier)
+ {
+ return new PageRenderer();
+ }
+
+ public override void PrepareViewController(NSPageController pageController, NSViewController viewController,
+ NSObject targetObject)
+ {
+ var pageContainer = targetObject as NSPageContainer;
+ var pageRenderer = (viewController as PageRenderer);
+ if (pageContainer == null || pageRenderer == null)
+ return;
+ Page page = pageContainer.Page;
+ pageRenderer.SetElement(page);
+ Platform.SetRenderer(page, pageRenderer);
+ }
+ }
+} \ No newline at end of file