summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.UAP/FormsPresenter.cs
diff options
context:
space:
mode:
authorJimmy Garrido <jimmygarrido@outlook.com>2016-12-02 16:17:38 -0800
committerRui Marinho <me@ruimarinho.net>2016-12-03 00:17:38 +0000
commit3da9a4cca74e694e1e000a7b92727cf413aba478 (patch)
tree7dcea948cdba9b3b5b0e8ead68769b030d8f6fcb /Xamarin.Forms.Platform.UAP/FormsPresenter.cs
parent281090c46669e87ef393062876e4a1b650c0adf0 (diff)
downloadxamarin-forms-3da9a4cca74e694e1e000a7b92727cf413aba478.tar.gz
xamarin-forms-3da9a4cca74e694e1e000a7b92727cf413aba478.tar.bz2
xamarin-forms-3da9a4cca74e694e1e000a7b92727cf413aba478.zip
Fix CommandBar overlaying content (#593)
Diffstat (limited to 'Xamarin.Forms.Platform.UAP/FormsPresenter.cs')
-rw-r--r--Xamarin.Forms.Platform.UAP/FormsPresenter.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.UAP/FormsPresenter.cs b/Xamarin.Forms.Platform.UAP/FormsPresenter.cs
new file mode 100644
index 00000000..50400cbd
--- /dev/null
+++ b/Xamarin.Forms.Platform.UAP/FormsPresenter.cs
@@ -0,0 +1,35 @@
+using System;
+using Windows.UI.Xaml;
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Platform.UWP
+{
+ internal class FormsPresenter : Windows.UI.Xaml.Controls.ContentPresenter
+ {
+ public FormsPresenter()
+ {
+ Loaded += FormsPresenter_Loaded;
+ Unloaded += FormsPresenter_Unloaded;
+ SizeChanged += (s, e) =>
+ {
+ if (ActualWidth > 0 && ActualHeight > 0)
+ {
+ var page = (Page)DataContext;
+ ((IPageController)page.RealParent).ContainerArea = new Rectangle(0, 0, ActualWidth, ActualHeight);
+ }
+ };
+ }
+
+ void FormsPresenter_Loaded(object sender, RoutedEventArgs e)
+ {
+ var page = (IPageController)DataContext;
+ page.SendAppearing();
+ }
+
+ void FormsPresenter_Unloaded(object sender, RoutedEventArgs e)
+ {
+ var page = (IPageController)DataContext;
+ page.SendDisappearing();
+ }
+ }
+}