summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-12-02 13:48:42 -0700
committerRui Marinho <me@ruimarinho.net>2016-12-02 20:48:42 +0000
commit4df66d139f8128486b3e34e1c206413abd1babd5 (patch)
tree3a7e1581240872ce3fff0559524cc6092d45014f /Xamarin.Forms.Platform.UAP/MasterDetailControl.cs
parentbadc701871a1190d6acb3495d3cefa93cff810c5 (diff)
downloadxamarin-forms-4df66d139f8128486b3e34e1c206413abd1babd5.tar.gz
xamarin-forms-4df66d139f8128486b3e34e1c206413abd1babd5.tar.bz2
xamarin-forms-4df66d139f8128486b3e34e1c206413abd1babd5.zip
Allow CommandBar to expand and show command labels (#594)
* Allow CommandBar to expand and show command labels Consolidate command bar placement code * Make title text wrapping consistent between NavigationPage and MasterDetailPage * Align toolbar/navigation bar behavior with other platforms
Diffstat (limited to 'Xamarin.Forms.Platform.UAP/MasterDetailControl.cs')
-rw-r--r--Xamarin.Forms.Platform.UAP/MasterDetailControl.cs28
1 files changed, 4 insertions, 24 deletions
diff --git a/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs b/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs
index dddd0ba6..2357232e 100644
--- a/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs
+++ b/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs
@@ -49,8 +49,7 @@ namespace Xamarin.Forms.Platform.UWP
new PropertyMetadata(default(Visibility)));
CommandBar _commandBar;
- Border _bottomCommandBarArea;
- Border _topCommandBarArea;
+ readonly ToolbarPlacementHelper _toolbarPlacementHelper = new ToolbarPlacementHelper();
TaskCompletionSource<CommandBar> _commandBarTcs;
FrameworkElement _masterPresenter;
@@ -174,7 +173,7 @@ namespace Xamarin.Forms.Platform.UWP
set
{
_toolbarPlacement = value;
- UpdateToolbarPlacement();
+ _toolbarPlacementHelper.UpdateToolbarPlacement();
}
}
@@ -236,17 +235,8 @@ namespace Xamarin.Forms.Platform.UWP
_detailPresenter = GetTemplateChild("DetailPresenter") as FrameworkElement;
_commandBar = GetTemplateChild("CommandBar") as CommandBar;
- _bottomCommandBarArea = GetTemplateChild("BottomCommandBarArea") as Border;
- _topCommandBarArea = GetTemplateChild("TopCommandBarArea") as Border;
-
- if (_commandBar != null && _bottomCommandBarArea != null && _topCommandBarArea != null)
- {
- // We have to wait for the command bar to load so that it'll be in the control hierarchy
- // otherwise we can't properly move it to wherever the toolbar is supposed to be
- _commandBar.Loaded += (sender, args) => UpdateToolbarPlacement();
- }
-
- UpdateToolbarPlacement();
+ _toolbarPlacementHelper.Initialize(_commandBar, () => ToolbarPlacement, GetTemplateChild);
+
UpdateMode();
if (_commandBarTcs != null)
@@ -263,11 +253,6 @@ namespace Xamarin.Forms.Platform.UWP
((MasterDetailControl)dependencyObject).UpdateMode();
}
- static void ToolbarPlacementChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
- {
- ((MasterDetailControl)dependencyObject).UpdateToolbarPlacement();
- }
-
static void CollapsedPaneWidthChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
((MasterDetailControl)dependencyObject).UpdateMode();
@@ -304,10 +289,5 @@ namespace Xamarin.Forms.Platform.UWP
? Visibility.Visible
: Visibility.Collapsed;
}
-
- void UpdateToolbarPlacement()
- {
- ToolbarPlacementHelper.UpdateToolbarPlacement(_commandBar, ToolbarPlacement, _bottomCommandBarArea, _topCommandBarArea);
- }
}
} \ No newline at end of file