summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.UAP
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
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')
-rw-r--r--Xamarin.Forms.Platform.UAP/FormsPresenter.cs35
-rw-r--r--Xamarin.Forms.Platform.UAP/PageControlStyle.xaml2
-rw-r--r--Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs29
-rw-r--r--Xamarin.Forms.Platform.UAP/TabbedPageStyle.xaml2
-rw-r--r--Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj1
5 files changed, 38 insertions, 31 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();
+ }
+ }
+}
diff --git a/Xamarin.Forms.Platform.UAP/PageControlStyle.xaml b/Xamarin.Forms.Platform.UAP/PageControlStyle.xaml
index 4f3f8835..f90cdeaa 100644
--- a/Xamarin.Forms.Platform.UAP/PageControlStyle.xaml
+++ b/Xamarin.Forms.Platform.UAP/PageControlStyle.xaml
@@ -26,7 +26,7 @@
</uwp:FormsCommandBar>
</Border>
- <ContentPresenter Margin="{TemplateBinding ContentMargin}" ContentTransitions="{TemplateBinding ContentTransitions}" x:Name="presenter" Grid.Row="1" />
+ <uwp:FormsPresenter Margin="{TemplateBinding ContentMargin}" ContentTransitions="{TemplateBinding ContentTransitions}" x:Name="presenter" Grid.Row="1" />
<Border x:Name="BottomCommandBarArea" Grid.Row="2" HorizontalAlignment="Stretch"></Border>
</Grid>
diff --git a/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs
index e9bbd4a1..568267db 100644
--- a/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.UAP/TabbedPageRenderer.cs
@@ -12,35 +12,6 @@ using WGrid = Windows.UI.Xaml.Controls.Grid;
namespace Xamarin.Forms.Platform.UWP
{
- internal class TabbedPagePresenter : Windows.UI.Xaml.Controls.ContentPresenter
- {
- public TabbedPagePresenter()
- {
- Loaded += TabbedPagePresenter_Loaded;
- Unloaded += TabbedPagePresenter_Unloaded;
- SizeChanged += (s, e) =>
- {
- if (ActualWidth > 0 && ActualHeight > 0)
- {
- var tab = (Page)DataContext;
- ((IPageController)tab.RealParent).ContainerArea = new Rectangle(0, 0, ActualWidth, ActualHeight);
- }
- };
- }
-
- void TabbedPagePresenter_Loaded(object sender, RoutedEventArgs e)
- {
- var tab = (IPageController)DataContext;
- tab.SendAppearing();
- }
-
- void TabbedPagePresenter_Unloaded(object sender, RoutedEventArgs e)
- {
- var tab = (IPageController)DataContext;
- tab.SendDisappearing();
- }
- }
-
public class TabbedPageRenderer : IVisualElementRenderer, ITitleProvider, IToolbarProvider
{
const string TabBarHeaderTextBlockName = "TabbedPageHeaderTextBlock";
diff --git a/Xamarin.Forms.Platform.UAP/TabbedPageStyle.xaml b/Xamarin.Forms.Platform.UAP/TabbedPageStyle.xaml
index 1fda50cd..ef7467c4 100644
--- a/Xamarin.Forms.Platform.UAP/TabbedPageStyle.xaml
+++ b/Xamarin.Forms.Platform.UAP/TabbedPageStyle.xaml
@@ -14,7 +14,7 @@
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
- <uwp:TabbedPagePresenter Content="{Binding}" ContentTemplate="{ThemeResource ContainedPageTemplate}" />
+ <uwp:FormsPresenter Content="{Binding}" ContentTemplate="{ThemeResource ContainedPageTemplate}" />
</DataTemplate>
</Setter.Value>
</Setter>
diff --git a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj
index 72c9245f..66ab6023 100644
--- a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj
+++ b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj
@@ -188,6 +188,7 @@
<Compile Include="..\Xamarin.Forms.Platform.WinRT\LayoutExtensions.cs">
<Link>LayoutExtensions.cs</Link>
</Compile>
+ <Compile Include="FormsPresenter.cs" />
<Compile Include="IToolBarForegroundBinder.cs" />
<Compile Include="NativeBindingService.cs" />
<Compile Include="NativeValueConverterService.cs" />