Skip to content

Commit

Permalink
Fixes #194 by switching every PopupAnimation to the according ones fr…
Browse files Browse the repository at this point in the history
…om SystemParameters and adding an option IsOpenAnimationEnabled to Backstage. IsOpenAnimationEnabled defaults to the value of SystemParameters.ClientAreaAnimation.
  • Loading branch information
batzen committed Dec 21, 2015
1 parent e9573e2 commit 90efb7e
Show file tree
Hide file tree
Showing 35 changed files with 92 additions and 58 deletions.
15 changes: 15 additions & 0 deletions Fluent.Ribbon/Controls/Backstage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ public bool HideContextTabsOnOpen
set { this.SetValue(HideContextTabsOnOpenProperty, value); }
}

/// <summary>
/// Gets or sets wether opening or closing should be animated.
/// </summary>
public bool IsOpenAnimationEnabled
{
get { return (bool)this.GetValue(IsOpenAnimationEnabledProperty); }
set { this.SetValue(IsOpenAnimationEnabledProperty, value); }
}

/// <summary>
/// Using a DependencyProperty as the backing store for IsOpenAnimationEnabled. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IsOpenAnimationEnabledProperty =
DependencyProperty.Register("IsOpenAnimationEnabled", typeof(bool), typeof(Backstage), new PropertyMetadata(true));

/// <summary>
/// Using a DependencyProperty as the backing store for HideContextTabsOnOpen.
/// This enables animation, styling, binding, etc...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,0,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -654,7 +654,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -1082,7 +1082,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,0,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2"
Expand Down Expand Up @@ -1439,7 +1439,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,0,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -874,7 +874,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
2 changes: 1 addition & 1 deletion Fluent.Ribbon/Themes/Office2010/Controls/ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
2 changes: 1 addition & 1 deletion Fluent.Ribbon/Themes/Office2010/Controls/Gallery.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
4 changes: 2 additions & 2 deletions Fluent.Ribbon/Themes/Office2010/Controls/MenuItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -717,7 +717,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@
Placement="Custom"
StaysOpen="True"
AllowsTransparency="True"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
VerticalOffset="-1"
IsOpen="{TemplateBinding IsDropDownOpen}"
HorizontalOffset="0">
Expand Down
2 changes: 1 addition & 1 deletion Fluent.Ribbon/Themes/Office2010/Controls/SplitButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
9 changes: 9 additions & 0 deletions Fluent.Ribbon/Themes/Office2013/Controls/Backstage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,14 @@
Value="0:0:0.2" />
<Setter Property="HideContextTabsOnOpen"
Value="True" />
<Setter Property="IsOpenAnimationEnabled"
Value="{DynamicResource {x:Static SystemParameters.ClientAreaAnimationKey}}" />
<Style.Triggers>
<Trigger Property="IsOpenAnimationEnabled"
Value="False">
<Setter Property="HideAnimationDuration"
Value="0" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -644,7 +644,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
38 changes: 24 additions & 14 deletions Fluent.Ribbon/Themes/Office2013/Controls/BackstageTabControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,26 +245,36 @@
</Grid>
</Grid>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding IsOpen, RelativeSource={RelativeSource AncestorType={x:Type Fluent:Backstage}}}"
Value="True">
<DataTrigger.EnterActions>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsOpen, RelativeSource={RelativeSource AncestorType={x:Type Fluent:Backstage}}}"
Value="True" />
<Condition Binding="{Binding IsOpenAnimationEnabled, RelativeSource={RelativeSource AncestorType={x:Type Fluent:Backstage}}}"
Value="True" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard x:Name="IsOpenBeginStoryboard"
Storyboard="{StaticResource OnIsOpenTrueStoryboard}" />
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
</MultiDataTrigger.EnterActions>
<MultiDataTrigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="IsOpenBeginStoryboard" />
</DataTrigger.ExitActions>
</DataTrigger>
<DataTrigger Binding="{Binding IsOpen, RelativeSource={RelativeSource AncestorType={x:Type Fluent:Backstage}}}"
Value="False">
<DataTrigger.EnterActions>
</MultiDataTrigger.ExitActions>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsOpen, RelativeSource={RelativeSource AncestorType={x:Type Fluent:Backstage}}}"
Value="False" />
<Condition Binding="{Binding IsOpenAnimationEnabled, RelativeSource={RelativeSource AncestorType={x:Type Fluent:Backstage}}}"
Value="True" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard x:Name="IsClosedBeginStoryboard"
Storyboard="{StaticResource OnIsOpenFalseStoryboard}" />
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
</MultiDataTrigger.EnterActions>
<MultiDataTrigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="IsClosedBeginStoryboard" />
</DataTrigger.ExitActions>
</DataTrigger>
</MultiDataTrigger.ExitActions>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>

Expand Down
2 changes: 1 addition & 1 deletion Fluent.Ribbon/Themes/Office2013/Controls/ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
2 changes: 1 addition & 1 deletion Fluent.Ribbon/Themes/Office2013/Controls/Gallery.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
4 changes: 2 additions & 2 deletions Fluent.Ribbon/Themes/Office2013/Controls/MenuItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -650,7 +650,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
Placement="Custom"
StaysOpen="True"
AllowsTransparency="True"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
IsOpen="{TemplateBinding IsDropDownOpen}"
HorizontalOffset="0">
<Grid Width="Auto"
Expand Down
2 changes: 1 addition & 1 deletion Fluent.Ribbon/Themes/Office2013/Controls/SplitButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,0,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -634,7 +634,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -1051,7 +1051,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,0,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2"
Expand Down Expand Up @@ -1398,7 +1398,7 @@
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimation}}"
Margin="0,0,0,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2"
Expand Down
4 changes: 2 additions & 2 deletions Fluent.Ribbon/Themes/Windows8/Controls/BackstageControls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down Expand Up @@ -731,7 +731,7 @@
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Fade"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimation}}"
Margin="0,0,-4,0"
VerticalAlignment="Top"
Grid.ColumnSpan="2">
Expand Down
Loading

0 comments on commit 90efb7e

Please sign in to comment.