Skip to content

Commit

Permalink
Update CornerRadius property on NavigationViewItem, PivotHeaderItem a…
Browse files Browse the repository at this point in the history
…nd ScrollBar (#922)

* Update NavigationVIewItem corner radius

* Update PivotHeaderItem corner radius

* Add ScrollBar template

* ScorllBar corner radius

* Add simple test

* Fix ScrollBar animation

* Fix rs5 test crash

* Fix ScrollBar behavior when animation is disabled

* Use conditional xaml in CornerRadiusPage

* Merge ScrollBar theme resource

* Conditional xaml fixes
  • Loading branch information
kaiguo authored Jul 3, 2019
1 parent c42f076 commit 7897ef3
Show file tree
Hide file tree
Showing 14 changed files with 354 additions and 1,917 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!-- 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:contract6Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,6)"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:contract8Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,8)"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Expand Down Expand Up @@ -78,7 +79,7 @@
<Setter Property="BorderThickness" Value="{ThemeResource CalendarDatePickerBorderThemeThickness}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="UseSystemFocusVisuals" Value="{ThemeResource IsApplicationFocusVisualKindReveal}" />
<contract6Present:Setter Property="UseSystemFocusVisuals" Value="{ThemeResource IsApplicationFocusVisualKindReveal}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarDatePicker">
Expand Down
10 changes: 10 additions & 0 deletions dev/CommonStyles/InteractionTests/CommonStylesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,15 @@ public void RunCompactTests()
Verify.AreEqual(testResult, "Pass", "We expect compact test result is Pass"); // "Pass" string matches value used by MUXControlsTestApp.SimpleVerify
}
}

[TestMethod]
public void CornerRadiusTest()
{
using (var setup = new TestSetupHelper("CornerRadius Tests"))
{
var textBlock = FindElement.ByName("CornerRadius");
Verify.IsNotNull(textBlock, "Verify corner radius page doesn't crash");
}
}
}
}
183 changes: 95 additions & 88 deletions dev/CommonStyles/TestUI/CornerRadiusPage.xaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dev/NavigationView/NavigationView.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<Page Include="$(MSBuildThisFileDirectory)NavigationView.xaml">
<Version>RS1</Version>
<Type>DefaultStyle</Type>
<UseNonstandardCondtionalXAML>true</UseNonstandardCondtionalXAML>
</Page>
<Page Include="$(MSBuildThisFileDirectory)NavigationView_rs1_themeresources.xaml">
<Version>RS1</Version>
Expand Down
4 changes: 3 additions & 1 deletion dev/NavigationView/NavigationView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:contract4Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,4)"
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
xmlns:local="using:Microsoft.UI.Xaml.Controls">
xmlns:local="using:Microsoft.UI.Xaml.Controls"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)">

<Style TargetType="local:NavigationView">
<Setter Property="PaneToggleButtonStyle" Value="{StaticResource PaneToggleButtonStyle}" />
Expand Down Expand Up @@ -508,6 +509,7 @@
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
Content="{TemplateBinding Content}"
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
IsTabStop="False">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ItemOnNavigationViewListPositionStates">
Expand Down
19 changes: 14 additions & 5 deletions dev/NavigationView/NavigationView_rs1_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
xmlns:contract4Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,4)"
xmlns:contract4NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,4)"
xmlns:media="using:Microsoft.UI.Xaml.Media">
xmlns:media="using:Microsoft.UI.Xaml.Media"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)">

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
Expand Down Expand Up @@ -574,7 +575,9 @@
Width="2"
Height="24"
Fill="{ThemeResource NavigationViewSelectionIndicatorForeground}"
Opacity="0.0"/>
Opacity="0.0"
contract7Present:RadiusX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.TopLeft}"
contract7Present:RadiusY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.BottomRight}"/>
</Grid>

<Border
Expand Down Expand Up @@ -673,7 +676,9 @@
Width="2"
Height="24"
Fill="{ThemeResource NavigationViewSelectionIndicatorForeground}"
Opacity="0.0"/>
Opacity="0.0"
contract7Present:RadiusX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.TopLeft}"
contract7Present:RadiusY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.BottomRight}"/>
</Grid>

<Grid
Expand Down Expand Up @@ -934,7 +939,9 @@
x:Name="SelectionIndicator"
Height="2"
Fill="{ThemeResource NavigationViewSelectionIndicatorForeground}"
Opacity="0" />
Opacity="0"
contract7Present:RadiusX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.TopLeft}"
contract7Present:RadiusY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.BottomRight}"/>
</Grid>
</Grid>
</ControlTemplate>
Expand Down Expand Up @@ -1031,7 +1038,9 @@
x:Name="SelectionIndicator"
Height="2"
Fill="{ThemeResource NavigationViewSelectionIndicatorForeground}"
Opacity="0" />
Opacity="0"
contract7Present:RadiusX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.TopLeft}"
contract7Present:RadiusY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.BottomRight}"/>
</Grid>
</Grid>
</ControlTemplate>
Expand Down
1 change: 1 addition & 0 deletions dev/Pivot/Pivot.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Page Include="$(MSBuildThisFileDirectory)Pivot_themeresources.xaml">
<Version>RS1</Version>
<Type>ThemeResources</Type>
<UseNonstandardCondtionalXAML>true</UseNonstandardCondtionalXAML>
</Page>
</ItemGroup>
</Project>
14 changes: 8 additions & 6 deletions dev/Pivot/Pivot_themeresources.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maps="using:Windows.UI.Xaml.Controls.Maps">
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)">

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
Expand Down Expand Up @@ -616,7 +616,9 @@
</Grid.RenderTransform>

<ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" OpticalMarginAlignment="TrimSideBearings" />
<Rectangle x:Name="SelectedPipe" Fill="{ThemeResource PivotHeaderItemSelectedPipeFill}" Height="2" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="0,0,0,2" />
<Rectangle x:Name="SelectedPipe" Fill="{ThemeResource PivotHeaderItemSelectedPipeFill}" Height="2" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="0,0,0,2"
contract7Present:RadiusX="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.TopLeft}"
contract7Present:RadiusY="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius.BottomRight}"/>

</Grid>
</ControlTemplate>
Expand Down
15 changes: 2 additions & 13 deletions dev/ScrollBar/ScrollBar.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,10 @@
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<ItemGroup>
<Page Include="$(MSBuildThisFileDirectory)ScrollBar_rs1_themeresources.xaml">
<Page Include="$(MSBuildThisFileDirectory)ScrollBar_themeresources.xaml">
<Version>RS1</Version>
<Type>ThemeResources</Type>
</Page>
<Page Include="$(MSBuildThisFileDirectory)ScrollBar_rs2_themeresources.xaml">
<Version>RS2</Version>
<Type>ThemeResources</Type>
</Page>
<Page Include="$(MSBuildThisFileDirectory)ScrollBar_rs3_themeresources.xaml">
<Version>RS3</Version>
<Type>ThemeResources</Type>
</Page>
<Page Include="$(MSBuildThisFileDirectory)ScrollBar_rs4_themeresources.xaml">
<Version>RS4</Version>
<Type>ThemeResources</Type>
<UseNonstandardCondtionalXAML>true</UseNonstandardCondtionalXAML>
</Page>
</ItemGroup>
</Project>
Loading

0 comments on commit 7897ef3

Please sign in to comment.