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

Binding CornerRadius to CommandBar.CornerRadius #4749

Merged
merged 5 commits into from
Apr 8, 2021
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
36 changes: 36 additions & 0 deletions dev/CommonStyles/APITests/CommonStylesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,42 @@ public void VerifyVisualTreeForControlsInCommonStyles()
}
}

[TestMethod]
public void VerifyVisualTreeForCommandBarCornerRadius()
{
if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone5))
{
return;
}

var xaml =
@"<StackPanel Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<CommandBar Background='Green' CornerRadius='10,10,10,10' IsOpen='True'>
<AppBarToggleButton Icon='Shuffle' Label='Shuffle' />
<AppBarToggleButton Icon='RepeatAll' Label='Repeat' />
<AppBarSeparator Margin='20,10,20,0' Foreground='Yellow'/>

<CommandBar.Content>
<TextBlock Text='Now playing...' Margin='12,14'/>
</CommandBar.Content>
</CommandBar>

<CommandBar Background='Green' CornerRadius='5,10,5,10' IsOpen='False'>
<AppBarToggleButton Icon='Shuffle' Label='Shuffle' />
<AppBarToggleButton Icon='RepeatAll' Label='Repeat' />
<AppBarSeparator Margin='20,10,20,0' Foreground='Yellow'/>

<CommandBar.Content>
<TextBlock Text='Now playing...' Margin='12,14'/>
</CommandBar.Content>
</CommandBar>
</StackPanel>";

VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
verificationFileNamePrefix: "VerifyVisualTreeForCommandBarCornerRadius");
}

[TestMethod]
[TestProperty("Ignore", "True")] // Disabled due to #2210: Unreliable test: CommonStylesApiTests.VerifyVisualTreeForCommandBarOverflowMenu
public void VerifyVisualTreeForCommandBarOverflowMenu()
Expand Down
32 changes: 23 additions & 9 deletions dev/CommonStyles/CommandBar_themeresources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<Setter Property="ClosedDisplayMode" Value="Compact" />
<Setter Property="ExitDisplayModeOnAccessKeyInvoked" Value="False" />
<Setter Property="CommandBarOverflowPresenterStyle" Value="{ThemeResource DefaultCommandBarOverflowPresenterStyle}" />
<contract7Present:Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CommandBar">
Expand Down Expand Up @@ -142,9 +143,12 @@
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource CommandBarBackgroundOpen}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<contract7NotPresent:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource ControlCornerRadius}" />
</ObjectAnimationUsingKeyFrames>
</contract7NotPresent:ObjectAnimationUsingKeyFrames>
<contract7Present:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius}" />
</contract7Present:ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="OpenBorder" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
Expand Down Expand Up @@ -214,9 +218,12 @@
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource CommandBarBackgroundOpen}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<contract7NotPresent:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource ControlCornerRadius}" />
</ObjectAnimationUsingKeyFrames>
</contract7NotPresent:ObjectAnimationUsingKeyFrames>
<contract7Present:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius}" />
</contract7Present:ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="OpenBorder" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
Expand Down Expand Up @@ -572,9 +579,12 @@
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource CommandBarBackgroundOpen}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<contract7NotPresent:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource ControlCornerRadius}" />
</ObjectAnimationUsingKeyFrames>
</contract7NotPresent:ObjectAnimationUsingKeyFrames>
<contract7Present:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius}" />
</contract7Present:ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="OpenBorder" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
Expand Down Expand Up @@ -603,9 +613,12 @@
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource CommandBarBackgroundOpen}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<contract7NotPresent:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{ThemeResource ControlCornerRadius}" />
</ObjectAnimationUsingKeyFrames>
</contract7NotPresent:ObjectAnimationUsingKeyFrames>
<contract7Present:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="CornerRadius">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CornerRadius}" />
</contract7Present:ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="OpenBorder" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible" />
</ObjectAnimationUsingKeyFrames>
Expand Down Expand Up @@ -881,7 +894,8 @@
VerticalAlignment="Stretch"
BorderThickness="{ThemeResource CommandBarBorderThicknessOpen}"
BorderBrush="{ThemeResource CommandBarBorderBrushOpen}"
contract7Present:CornerRadius="{ThemeResource ControlCornerRadius}" />
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
contract7NotPresent:CornerRadius="{ThemeResource ControlCornerRadius}" />
</Grid>
<Popup x:Name="OverflowPopup">
<Popup.RenderTransform>
Expand Down
Loading