Skip to content

Commit

Permalink
(GH-3910) Add BannerBackground and BannerForeground to FlipView
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Nov 23, 2020
1 parent 51851cf commit 87c6f6f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
32 changes: 32 additions & 0 deletions src/MahApps.Metro/Controls/FlipView.cs
Expand Up @@ -281,6 +281,38 @@ public string BannerText
set => this.SetValue(BannerTextProperty, value);
}

/// <summary>Identifies the <see cref="BannerBackground"/> dependency property.</summary>
public static readonly DependencyProperty BannerBackgroundProperty
= DependencyProperty.Register(nameof(BannerBackground),
typeof(Brush),
typeof(FlipView),
new FrameworkPropertyMetadata(null));

/// <summary>
/// Gets or sets a <see cref="T:System.Windows.Media.Brush" /> that is used to fill the banner.
/// </summary>
public Brush BannerBackground
{
get => (Brush)this.GetValue(BannerBackgroundProperty);
set => this.SetValue(BannerBackgroundProperty, value);
}

/// <summary>Identifies the <see cref="BannerForeground"/> dependency property.</summary>
public static readonly DependencyProperty BannerForegroundProperty
= DependencyProperty.Register(nameof(BannerForeground),
typeof(Brush),
typeof(FlipView),
new FrameworkPropertyMetadata(SystemColors.ControlTextBrush));

/// <summary>
/// Gets or sets a <see cref="T:System.Windows.Media.Brush" /> that describes the foreground color of the banner label.
/// </summary>
public Brush BannerForeground
{
get => (Brush)this.GetValue(BannerForegroundProperty);
set => this.SetValue(BannerForegroundProperty, value);
}

private const string PART_BackButton = "PART_BackButton";
private const string PART_BannerGrid = "PART_BannerGrid";
private const string PART_BannerLabel = "PART_BannerLabel";
Expand Down
6 changes: 4 additions & 2 deletions src/MahApps.Metro/Themes/FlipView.xaml
Expand Up @@ -133,12 +133,12 @@
Height="0"
VerticalAlignment="Bottom"
Panel.ZIndex="5"
Background="{DynamicResource MahApps.Brushes.ThemeForeground}"
Background="{TemplateBinding BannerBackground}"
Opacity="0.85">
<Label x:Name="PART_BannerLabel"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
Foreground="{DynamicResource MahApps.Brushes.ThemeBackground}"
Foreground="{TemplateBinding BannerForeground}"
IsTabStop="False" />
</Grid>

Expand Down Expand Up @@ -221,6 +221,8 @@
</ControlTemplate>

<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="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Cycle" />
Expand Down

0 comments on commit 87c6f6f

Please sign in to comment.