diff options
author | Jimmy Garrido <jimmygarrido@outlook.com> | 2017-03-06 14:19:36 -0800 |
---|---|---|
committer | Samantha Houts <samantha@teamredwall.com> | 2017-03-06 14:19:36 -0800 |
commit | 65d848051912e1522d692ba647945625f271b23c (patch) | |
tree | ce20973c7656e2ca170299f9f163ccc430cd7b52 /Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs | |
parent | 8bc7ba3faade6e7396347f20dd8968fd35491671 (diff) | |
download | xamarin-forms-65d848051912e1522d692ba647945625f271b23c.tar.gz xamarin-forms-65d848051912e1522d692ba647945625f271b23c.tar.bz2 xamarin-forms-65d848051912e1522d692ba647945625f271b23c.zip |
[UWP] Improve toolbar consistency on MasterDetailPage (#744)
* Improve toolbar consistency on MasterDetailPage
* Properly indent xaml page
Diffstat (limited to 'Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs b/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs index b2b0d8b3..d6518d2e 100644 --- a/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/MasterDetailPageRenderer.cs @@ -146,19 +146,17 @@ namespace Xamarin.Forms.Platform.UWP } e.NewElement.PropertyChanged += OnElementPropertyChanged; + UpdateMode(); UpdateDetail(); UpdateMaster(); - UpdateMode(); UpdateIsPresented(); if (!string.IsNullOrEmpty(e.NewElement.AutomationId)) Control.SetValue(AutomationProperties.AutomationIdProperty, e.NewElement.AutomationId); -#if WINDOWS_UWP - UpdateToolbarPlacement(); -#endif - - } + ((ITitleProvider)this).BarBackgroundBrush = (Brush)Windows.UI.Xaml.Application.Current.Resources["SystemControlBackgroundChromeMediumLowBrush"]; + UpdateToolbarPlacement(); + } } protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) @@ -267,8 +265,7 @@ namespace Xamarin.Forms.Platform.UWP IVisualElementRenderer renderer = _detail.GetOrCreateRenderer(); element = renderer.ContainerElement; - // Enforce consistency rules on toolbar (show toolbar if Detail is Navigation Page) - Control.ShouldShowToolbar = _detail is NavigationPage; + UpdateToolbarVisibilty(); } Control.Detail = element; @@ -311,24 +308,28 @@ namespace Xamarin.Forms.Platform.UWP Control.Master = element; Control.MasterTitle = _master?.Title; - // Enforce consistency rules on toolbar (show toolbar if Master is Navigation Page) - Control.ShouldShowToolbar = _master is NavigationPage; + UpdateToolbarVisibilty(); } void UpdateMode() { + UpdateDetailTitle(); Control.CollapseStyle = Element.OnThisPlatform().GetCollapseStyle(); Control.CollapsedPaneWidth = Element.OnThisPlatform().CollapsedPaneWidth(); Control.ShouldShowSplitMode = MasterDetailPageController.ShouldShowSplitMode; } -#if WINDOWS_UWP - - void UpdateToolbarPlacement() + void UpdateToolbarPlacement() { Control.ToolbarPlacement = Element.OnThisPlatform().GetToolbarPlacement(); } + void UpdateToolbarVisibilty() + { + // Enforce consistency rules on toolbar + Control.ShouldShowToolbar = _detail is NavigationPage || _master is NavigationPage; + } + public void BindForegroundColor(AppBar appBar) { SetAppBarForegroundBinding(appBar); @@ -344,6 +345,5 @@ namespace Xamarin.Forms.Platform.UWP element.SetBinding(Windows.UI.Xaml.Controls.Control.ForegroundProperty, new Windows.UI.Xaml.Data.Binding { Path = new PropertyPath("Control.ToolbarForeground"), Source = this, RelativeSource = new RelativeSource { Mode = RelativeSourceMode.TemplatedParent } }); } -#endif } }
\ No newline at end of file |