Skip to content

Commit

Permalink
(GH-3910) Add BannerOpacity to FlipView
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Nov 23, 2020
1 parent 87c6f6f commit 92a0db7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/MahApps.Metro/Controls/FlipView.cs
Expand Up @@ -313,6 +313,22 @@ public Brush BannerForeground
set => this.SetValue(BannerForegroundProperty, value);
}

/// <summary>Identifies the <see cref="BannerOpacity"/> dependency property.</summary>
public static readonly DependencyProperty BannerOpacityProperty
= DependencyProperty.Register(nameof(BannerOpacity),
typeof(double),
typeof(FlipView),
new UIPropertyMetadata(1.0));

/// <summary>
/// Gets or sets the opacity factor applied to the entire banner when it is rendered in the user interface (UI).
/// </summary>
public double BannerOpacity
{
get => (double)this.GetValue(BannerOpacityProperty);
set => this.SetValue(BannerOpacityProperty, value);
}

private const string PART_BackButton = "PART_BackButton";
private const string PART_BannerGrid = "PART_BannerGrid";
private const string PART_BannerLabel = "PART_BannerLabel";
Expand Down
3 changes: 2 additions & 1 deletion src/MahApps.Metro/Themes/FlipView.xaml
Expand Up @@ -134,7 +134,7 @@
VerticalAlignment="Bottom"
Panel.ZIndex="5"
Background="{TemplateBinding BannerBackground}"
Opacity="0.85">
Opacity="{TemplateBinding BannerOpacity}">
<Label x:Name="PART_BannerLabel"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Expand Down Expand Up @@ -223,6 +223,7 @@
<Style x:Key="MahApps.Styles.FlipView" TargetType="{x:Type mah:FlipView}">
<Setter Property="BannerBackground" Value="{DynamicResource MahApps.Brushes.ThemeForeground}" />
<Setter Property="BannerForeground" Value="{DynamicResource MahApps.Brushes.ThemeBackground}" />
<Setter Property="BannerOpacity" Value="0.8" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Cycle" />
Expand Down

0 comments on commit 92a0db7

Please sign in to comment.