Skip to content

Commit

Permalink
Merge pull request #16 from amkuchta/GH13_HeaderForegroundFix
Browse files Browse the repository at this point in the history
Header Foreground Fix
  • Loading branch information
AleksandarDev authored May 30, 2018
2 parents 7754595 + 8520738 commit 96614f4
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 88 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.3.1] - 2018-05-30
### Fixed
- Fixed message header foreground not set by `SetForeground` method call.

## [1.3.0] - 2018-05-03
### Added
- Added notification fade-out and fade-in animations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<projectUrl>https://github.com/Enterwell/Wpf.Notifications</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>Added notification fade-out and fade-in animations.</releaseNotes>
<releaseNotes>Fixed message header foreground not set by `SetForeground` method call.</releaseNotes>
<copyright>Copyright (c) Enterwell d.o.o. 2017-2018</copyright>
<tags>wpf notifications</tags>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
158 changes: 73 additions & 85 deletions Enterwell.Clients.Wpf.Notifications/Themes/Generic.xaml
Original file line number Diff line number Diff line change
@@ -1,69 +1,64 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Enterwell.Clients.Wpf.Notifications.Controls"
xmlns:local="clr-namespace:Enterwell.Clients.Wpf.Notifications">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Enterwell.Clients.Wpf.Notifications.Controls"
xmlns:local="clr-namespace:Enterwell.Clients.Wpf.Notifications">

<SolidColorBrush x:Key="NotificationButtonDarkBackgroundOverlayBrush">#333333</SolidColorBrush>
<SolidColorBrush x:Key="NotificationButtonDarkBackgroundOverlayPressedBrush">#666666</SolidColorBrush>
<SolidColorBrush x:Key="NotificationButtonDarkBackgroundOverlayDisabledBrush">#FFFFFF</SolidColorBrush>

<Style x:Key="NotificationBadgeBaseStyle" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="11" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="White" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,2,0,2" />
<Setter Property="Padding" Value="4,2" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="11" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="Bold" />
</Style>

<Style x:Key="NotificationHeaderTextStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="Light" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Light" />
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=Foreground}" />
<Setter Property="Margin" Value="0,0,8,0" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>

<Style x:Key="NotificationMessageTextStyle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=Foreground}" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Margin" Value="0,0,8,0" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="NotificationMessageButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Foreground" Value="#EAEAEA" />
<Setter Property="Padding" Value="12,2" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="12,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Border
x:Name="backgroundBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="True" />
<Border
x:Name="backgroundOverlay"
BorderThickness="0"
Opacity="0.3"
SnapsToDevicePixels="True" />
<ContentPresenter
x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Border x:Name="backgroundBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="True" />
<Border x:Name="backgroundOverlay"
BorderThickness="0"
Opacity="0.3"
SnapsToDevicePixels="True" />
<ContentPresenter x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsDefaulted" Value="True">
Expand All @@ -82,31 +77,30 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>

<Style TargetType="{x:Type controls:NotificationMessage}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:NotificationMessage}">
<Border
MinHeight="35"
VerticalAlignment="Top"
Background="{TemplateBinding Background}"
BorderBrush="#882F2F2F"
BorderThickness="0,0,0,1"
SnapsToDevicePixels="True"
UseLayoutRounding="True">
<Border MinHeight="35"
VerticalAlignment="Top"
Background="{TemplateBinding Background}"
BorderBrush="#882F2F2F"
BorderThickness="0,0,0,1"
SnapsToDevicePixels="True"
UseLayoutRounding="True">
<Grid>
<Grid.Resources>
<!-- Accent button style -->
<Style BasedOn="{StaticResource NotificationMessageButtonStyle}" TargetType="{x:Type controls:NotificationMessageButton}">
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=ButtonAccentBrush}" />
</Style>
<!-- Accent badge style -->
<Style
x:Key="NotificationBadgeAccentStyle"
BasedOn="{StaticResource NotificationBadgeBaseStyle}"
TargetType="{x:Type TextBlock}">
<Style x:Key="NotificationBadgeAccentStyle"
BasedOn="{StaticResource NotificationBadgeBaseStyle}"
TargetType="{x:Type TextBlock}">
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=BadgeAccentBrush}" />
</Style>
</Grid.Resources>
Expand All @@ -117,11 +111,17 @@
</Grid.ColumnDefinitions>

<!-- Badge -->
<TextBlock
Grid.Column="0"
Style="{StaticResource NotificationBadgeAccentStyle}"
Text="{TemplateBinding BadgeText}"
Visibility="{TemplateBinding BadgeVisibility}" />
<TextBlock Grid.Column="0"
Style="{StaticResource NotificationBadgeAccentStyle}"
Text="{TemplateBinding BadgeText}"
Visibility="{TemplateBinding BadgeVisibility}" />

<!-- Overlay content -->
<ContentControl Grid.Column="0"
Grid.ColumnSpan="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{TemplateBinding OverlayContent}" />

<!-- Header and message -->
<Grid Grid.Column="1" Margin="10,8">
Expand All @@ -130,17 +130,15 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<TextBlock
Grid.Row="0"
Style="{StaticResource NotificationHeaderTextStyle}"
Text="{TemplateBinding Header}"
Visibility="{TemplateBinding HeaderVisibility}" />
<TextBlock Grid.Row="0"
Style="{StaticResource NotificationHeaderTextStyle}"
Text="{TemplateBinding Header}"
Visibility="{TemplateBinding HeaderVisibility}" />

<TextBlock
Grid.Row="1"
Style="{StaticResource NotificationMessageTextStyle}"
Text="{TemplateBinding Message}"
Visibility="{TemplateBinding MessageVisibility}" />
<TextBlock Grid.Row="1"
Style="{StaticResource NotificationMessageTextStyle}"
Text="{TemplateBinding Message}"
Visibility="{TemplateBinding MessageVisibility}" />
</Grid>

<!-- Buttons -->
Expand All @@ -156,14 +154,6 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<!-- Overlay content -->
<ContentControl
Grid.Column="0"
Grid.ColumnSpan="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{TemplateBinding OverlayContent}" />
</Grid>
</Border>
</ControlTemplate>
Expand All @@ -180,31 +170,29 @@
</Setter.Value>
</Setter>
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:NotificationMessageContainer}">
<Grid>
<Border
x:Name="ItemsBorder"
Margin="12,0,12,12"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="true"
UseLayoutRounding="True">
<Border x:Name="ItemsBorder"
Margin="12,0,12,12"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="true"
UseLayoutRounding="True">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<ItemsPresenter.Effect>
<DropShadowEffect
BlurRadius="10"
Direction="270"
Opacity="0.3"
Color="Black" />
<DropShadowEffect BlurRadius="10"
Direction="270"
Opacity="0.3"
Color="Black" />
</ItemsPresenter.Effect>
</ItemsPresenter>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
</ResourceDictionary>

0 comments on commit 96614f4

Please sign in to comment.