summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-08-30 10:46:14 -0700
committerJason Smith <jason.smith@xamarin.com>2016-08-30 10:46:14 -0700
commit5e553f6195e66e48688b8ab324f1bab1e9251f0a (patch)
treef8843e5e9e8afe89a05a1cc91c3b7fa05588bac7 /Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
parentf551654b1cfe654c579ca50978445e7cb93f287d (diff)
downloadxamarin-forms-5e553f6195e66e48688b8ab324f1bab1e9251f0a.tar.gz
xamarin-forms-5e553f6195e66e48688b8ab324f1bab1e9251f0a.tar.bz2
xamarin-forms-5e553f6195e66e48688b8ab324f1bab1e9251f0a.zip
Platform Specifics (#301)
* Playing around with how the platform specifics interfaces etc. might work * Sample implementation of iOS navigation translucency * Very slightly reduced code * Better vendor stuff * Drop single-implemenation interfaces * Generics on NavigationPage * On-demand vendor stuff * Remove functionally duplicate classes and make ControlGallery work again * Namespace all the things. XAML test. * Can use Effect to attach platform specific * Attach Effect on PropertyChanging for XAML support! * Rename IConfigPlatform interfaces for readability * Some renaming to match the documents * Split class files * Clear out test-only code * Re-namespace * Added On method to rendered Elements * Allow for removal of platform suffix, convenience methods on specific platforms * Creating a gallery page for specifics * Add rudimentary Platform Specifics gallery; make CollapseStyle work on UWP; Add CollapsedPaneWidth specific property * Toolbar now working with both collapse styles * MDP now displaying Content title; toolbar routing around title * Add a gallery for the iOS NavigationPage stuff * Add Navigation Page as detail page to verify it works with new Toolbar options * Make titlebar/toolbar background colors consistent * ToolbarPlacement now working on NavigationPage * Toolbar Placement working for tabbed and nav pages * Fix bug where phone doesn't get default toolbar placement on start * [Core] Add PS WindowSoftInputModeAdjust [Core] Make Application extendable * Toolbar placement now working on Nav, Tabbed, and Master pages on desktop/phone Remove unnecessary style indirection Fix build errors * [A] Add PlatformConfigurationExtensions * SetSoftInputMode test page * [A] SetSoftInputMode Known issue: Status bar color does not work in AdjustResize mode * [Core] Add PS Blur * [iOS] Configure renderer for blur * Add test page * Move to blur VisualElement for broader support * Move test pages to gallery * Update docs * Use lazy initializer for PlatformConfigurationRegistry
Diffstat (limited to 'Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs36
1 files changed, 27 insertions, 9 deletions
diff --git a/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs b/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
index c424c7fe..f0048154 100644
--- a/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
+++ b/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs
@@ -6,6 +6,8 @@ using Windows.UI.Xaml.Automation;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
+using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;
+using Specifics = Xamarin.Forms.PlatformConfiguration.WindowsSpecific.MasterDetailPage;
namespace Xamarin.Forms.Platform.UWP
{
@@ -56,7 +58,7 @@ namespace Xamarin.Forms.Platform.UWP
set { Control.ToolbarForeground = value; }
}
-IPageController PageController => Element as IPageController;
+ IPageController PageController => Element as IPageController;
IMasterDetailPageController MasterDetailPageController => Element as IMasterDetailPageController;
@@ -68,11 +70,9 @@ IPageController PageController => Element as IPageController;
{
if (_showTitle == value)
return;
+
_showTitle = value;
- if (_showTitle)
- Control.DetailTitleVisibility = Visibility.Visible;
- else
- Control.DetailTitleVisibility = Visibility.Collapsed;
+ Control.DetailTitleVisibility = _showTitle ? Visibility.Visible : Visibility.Collapsed;
}
}
@@ -132,7 +132,7 @@ IPageController PageController => Element as IPageController;
{
Control = new MasterDetailControl();
Control.Loaded += OnControlLoaded;
- Control.Unloaded += OnControlUnlaoded;
+ Control.Unloaded += OnControlUnloaded;
Control.SizeChanged += OnNativeSizeChanged;
Control.RegisterPropertyChangedCallback(MasterDetailControl.IsPaneOpenProperty, OnIsPaneOpenChanged);
@@ -148,7 +148,12 @@ IPageController PageController => Element as IPageController;
if (!string.IsNullOrEmpty(e.NewElement.AutomationId))
Control.SetValue(AutomationProperties.AutomationIdProperty, e.NewElement.AutomationId);
- }
+
+#if WINDOWS_UWP
+ UpdateToolbarPlacement();
+#endif
+
+ }
}
protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
@@ -159,8 +164,12 @@ IPageController PageController => Element as IPageController;
UpdateMaster();
else if (e.PropertyName == "Detail")
UpdateDetail();
- else if (e.PropertyName == "ShouldShowSplitMode")
+ else if (e.PropertyName == nameof(MasterDetailControl.ShouldShowSplitMode)
+ || e.PropertyName == Specifics.CollapseStyleProperty.PropertyName
+ || e.PropertyName == Specifics.CollapsedPaneWidthProperty.PropertyName)
UpdateMode();
+ else if(e.PropertyName == PlatformConfiguration.WindowsSpecific.Page.ToolbarPlacementProperty.PropertyName)
+ UpdateToolbarPlacement();
}
void ClearDetail()
@@ -202,7 +211,7 @@ IPageController PageController => Element as IPageController;
UpdateBounds();
}
- void OnControlUnlaoded(object sender, RoutedEventArgs routedEventArgs)
+ void OnControlUnloaded(object sender, RoutedEventArgs routedEventArgs)
{
PageController?.SendDisappearing();
}
@@ -264,6 +273,7 @@ IPageController PageController => Element as IPageController;
return;
Control.DetailTitle = (_detail as NavigationPage)?.CurrentPage?.Title ?? _detail.Title ?? Element?.Title;
+ (this as ITitleProvider).ShowTitle = !string.IsNullOrEmpty(Control.DetailTitle);
}
void UpdateIsPresented()
@@ -291,10 +301,18 @@ IPageController PageController => Element as IPageController;
void UpdateMode()
{
+ Control.CollapseStyle = Element.OnThisPlatform().GetCollapseStyle();
+ Control.CollapsedPaneWidth = Element.OnThisPlatform().CollapsedPaneWidth();
Control.ShouldShowSplitMode = MasterDetailPageController.ShouldShowSplitMode;
}
#if WINDOWS_UWP
+
+ void UpdateToolbarPlacement()
+ {
+ Control.ToolbarPlacement = Element.OnThisPlatform().GetToolbarPlacement();
+ }
+
public void BindForegroundColor(AppBar appBar)
{
SetAppBarForegroundBinding(appBar);