Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with HorizontalContentAlignment not working on NavigationViewItem #1325

Merged
merged 3 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dev/NavigationView/NavigationView_rs1_themeresources.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down Expand Up @@ -589,7 +589,8 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />

<Grid HorizontalAlignment="Left"
<Grid
HorizontalAlignment="Stretch"
x:Name="ContentGrid"
MinHeight="{ThemeResource NavigationViewItemOnLeftMinHeight}">
<Grid.ColumnDefinitions>
Expand Down
1 change: 1 addition & 0 deletions dev/NavigationView/TestUI/NavigationViewCaseBundle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<Button x:Name="NavigateToMinimalPage" AutomationProperties.Name="Navigation Minimal Test" Margin="2" HorizontalAlignment="Stretch">Navigation Minimal Test</Button>
<Button x:Name="NavigateToCustomThemeResourcesPage" AutomationProperties.Name="NavigationView custom ThemeResources Test" Margin="2" HorizontalAlignment="Stretch">NavigationView with custom ThemeResources Test</Button>
<Button x:Name="NavigationViewBlankPage1" AutomationProperties.Name="NavigationView Blank Test1" Margin="2" HorizontalAlignment="Stretch">NavigationView Blank Test1</Button>
<Button x:Name="NavigationViewMenuItemStretchPageButton" AutomationProperties.Name="NavigationView Menuitem Stretch Test" Margin="2" HorizontalAlignment="Stretch">NavigationView Menuitem Stretch Test</Button>
</StackPanel>
</Grid>
</local:TestPage>
1 change: 1 addition & 0 deletions dev/NavigationView/TestUI/NavigationViewCaseBundle.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public NavigationViewCaseBundle()
NavigateToMinimalPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewMinimalPage), 0); };
NavigateToCustomThemeResourcesPage.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewCustomThemeResourcesPage), 0); };
NavigationViewBlankPage1.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewBlankPage1), 0); };
NavigationViewMenuItemStretchPageButton.Click += delegate { Frame.NavigateWithoutAnimation(typeof(NavigationViewMenuItemStretchPage), 0); };
}
}
}
40 changes: 40 additions & 0 deletions dev/NavigationView/TestUI/NavigationViewMenuItemStretchPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<local:TestPage
x:Class="MUXControlsTestApp.NavigationViewMenuItemStretchPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MUXControlsTestApp"
xmlns:muxcontrols="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<!-- This page contains a NavigationView control that is in LeftMinimal mode on initial load -->
<StackPanel>
<muxcontrols:NavigationView >
<muxcontrols:NavigationView.MenuItems>
<muxcontrols:NavigationViewItem HorizontalContentAlignment="Center" Icon="Find" Tag="find" IsSelected="True">
<Border Background="Red">
<TextBlock>Center</TextBlock>
</Border>
</muxcontrols:NavigationViewItem>
<muxcontrols:NavigationViewItem HorizontalContentAlignment="Left" Icon="Find" Tag="find" IsSelected="True">
<Border Background="Red">
<TextBlock>Left</TextBlock>
</Border>
</muxcontrols:NavigationViewItem>
<muxcontrols:NavigationViewItem HorizontalContentAlignment="Right" Icon="Find" Tag="find" IsSelected="True">
<Border Background="Red">
<TextBlock>Right</TextBlock>
</Border>
</muxcontrols:NavigationViewItem>
<muxcontrols:NavigationViewItem HorizontalContentAlignment="Stretch" Icon="Find" Tag="find" IsSelected="True">
<Border Background="Red">
<TextBlock>Stretch</TextBlock>
</Border>
</muxcontrols:NavigationViewItem>

</muxcontrols:NavigationView.MenuItems>
</muxcontrols:NavigationView>
</StackPanel>
</local:TestPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace MUXControlsTestApp
{
public sealed partial class NavigationViewMenuItemStretchPage : TestPage
{
public NavigationViewMenuItemStretchPage()
{
this.InitializeComponent();
}
}
}
14 changes: 12 additions & 2 deletions dev/NavigationView/TestUI/NavigationView_TestUI.projitems
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
Expand Down Expand Up @@ -26,6 +26,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)NavigationViewMenuItemStretchPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)NavigationViewMinimalPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -92,8 +96,9 @@
<Compile Include="$(MSBuildThisFileDirectory)NavigationViewIsPaneOpenPage.xaml.cs">
<DependentUpon>NavigationViewIsPaneOpenPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)NavigationViewMenuItemStretchPage.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NavigationViewMinimalPage.xaml.cs">
<DependentUpon>NavigationViewMinimalPage.xaml</DependentUpon>
<DependentUpon>NavigationViewMinimalPage.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)NavigationViewStretchPage.xaml.cs">
<DependentUpon>NavigationViewStretchPage.xaml</DependentUpon>
Expand Down Expand Up @@ -132,4 +137,9 @@
<DependentUpon>NavigationViewTopNavStorePage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Update="D:\Projects\microsoft-ui-xaml\dev\NavigationView\TestUI\NavigationViewMenuItemStretchPage.xaml.cs">
<DependentUpon>NavigationViewMenuItemStretchPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>