Skip to content

Commit 96614f4

Browse files
Merge pull request #16 from amkuchta/GH13_HeaderForegroundFix
Header Foreground Fix
2 parents 7754595 + 8520738 commit 96614f4

File tree

4 files changed

+80
-88
lines changed

4 files changed

+80
-88
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [1.3.1] - 2018-05-30
8+
### Fixed
9+
- Fixed message header foreground not set by `SetForeground` method call.
10+
711
## [1.3.0] - 2018-05-03
812
### Added
913
- Added notification fade-out and fade-in animations.

Enterwell.Clients.Wpf.Notifications/Enterwell.Clients.Wpf.Notifications.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<projectUrl>https://github.com/Enterwell/Wpf.Notifications</projectUrl>
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>$description$</description>
13-
<releaseNotes>Added notification fade-out and fade-in animations.</releaseNotes>
13+
<releaseNotes>Fixed message header foreground not set by `SetForeground` method call.</releaseNotes>
1414
<copyright>Copyright (c) Enterwell d.o.o. 2017-2018</copyright>
1515
<tags>wpf notifications</tags>
1616
</metadata>

Enterwell.Clients.Wpf.Notifications/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@
4949
// You can specify all the values or you can default the Build and Revision Numbers
5050
// by using the '*' as shown below:
5151
// [assembly: AssemblyVersion("1.0.*")]
52-
[assembly: AssemblyVersion("1.3.0.0")]
53-
[assembly: AssemblyFileVersion("1.3.0.0")]
52+
[assembly: AssemblyVersion("1.3.1.0")]
53+
[assembly: AssemblyFileVersion("1.3.1.0")]
Lines changed: 73 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,64 @@
1-
<ResourceDictionary
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:controls="clr-namespace:Enterwell.Clients.Wpf.Notifications.Controls"
5-
xmlns:local="clr-namespace:Enterwell.Clients.Wpf.Notifications">
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:controls="clr-namespace:Enterwell.Clients.Wpf.Notifications.Controls"
4+
xmlns:local="clr-namespace:Enterwell.Clients.Wpf.Notifications">
65

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

1110
<Style x:Key="NotificationBadgeBaseStyle" TargetType="{x:Type TextBlock}">
11+
<Setter Property="FontSize" Value="11" />
12+
<Setter Property="FontWeight" Value="Bold" />
13+
<Setter Property="Foreground" Value="White" />
14+
<Setter Property="HorizontalAlignment" Value="Center" />
1215
<Setter Property="Margin" Value="10,2,0,2" />
1316
<Setter Property="Padding" Value="4,2" />
14-
<Setter Property="HorizontalAlignment" Value="Center" />
1517
<Setter Property="VerticalAlignment" Value="Center" />
16-
<Setter Property="FontSize" Value="11" />
17-
<Setter Property="Foreground" Value="White" />
18-
<Setter Property="FontWeight" Value="Bold" />
1918
</Style>
2019

2120
<Style x:Key="NotificationHeaderTextStyle" TargetType="{x:Type TextBlock}">
22-
<Setter Property="Foreground" Value="White" />
23-
<Setter Property="FontWeight" Value="Light" />
2421
<Setter Property="FontSize" Value="16" />
22+
<Setter Property="FontWeight" Value="Light" />
23+
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=Foreground}" />
2524
<Setter Property="Margin" Value="0,0,8,0" />
2625
<Setter Property="TextWrapping" Value="Wrap" />
2726
</Style>
2827

2928
<Style x:Key="NotificationMessageTextStyle" TargetType="{x:Type TextBlock}">
30-
<Setter Property="VerticalAlignment" Value="Center" />
3129
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=Foreground}" />
32-
<Setter Property="TextWrapping" Value="Wrap" />
3330
<Setter Property="Margin" Value="0,0,8,0" />
31+
<Setter Property="TextWrapping" Value="Wrap" />
32+
<Setter Property="VerticalAlignment" Value="Center" />
3433
</Style>
3534

3635
<Style x:Key="NotificationMessageButtonStyle" TargetType="{x:Type Button}">
3736
<Setter Property="Foreground" Value="#EAEAEA" />
38-
<Setter Property="Padding" Value="12,2" />
39-
<Setter Property="VerticalContentAlignment" Value="Center" />
4037
<Setter Property="HorizontalContentAlignment" Value="Center" />
38+
<Setter Property="Padding" Value="12,2" />
4139
<Setter Property="Template">
4240
<Setter.Value>
4341
<ControlTemplate TargetType="{x:Type Button}">
4442
<Grid>
45-
<Border
46-
x:Name="backgroundBorder"
47-
Background="{TemplateBinding Background}"
48-
BorderBrush="{TemplateBinding Background}"
49-
BorderThickness="{TemplateBinding BorderThickness}"
50-
SnapsToDevicePixels="True" />
51-
<Border
52-
x:Name="backgroundOverlay"
53-
BorderThickness="0"
54-
Opacity="0.3"
55-
SnapsToDevicePixels="True" />
56-
<ContentPresenter
57-
x:Name="contentPresenter"
58-
Margin="{TemplateBinding Padding}"
59-
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
60-
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
61-
Content="{TemplateBinding Content}"
62-
ContentStringFormat="{TemplateBinding ContentStringFormat}"
63-
ContentTemplate="{TemplateBinding ContentTemplate}"
64-
Focusable="False"
65-
RecognizesAccessKey="True"
66-
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
43+
<Border x:Name="backgroundBorder"
44+
Background="{TemplateBinding Background}"
45+
BorderBrush="{TemplateBinding Background}"
46+
BorderThickness="{TemplateBinding BorderThickness}"
47+
SnapsToDevicePixels="True" />
48+
<Border x:Name="backgroundOverlay"
49+
BorderThickness="0"
50+
Opacity="0.3"
51+
SnapsToDevicePixels="True" />
52+
<ContentPresenter x:Name="contentPresenter"
53+
Margin="{TemplateBinding Padding}"
54+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
55+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
56+
Content="{TemplateBinding Content}"
57+
ContentStringFormat="{TemplateBinding ContentStringFormat}"
58+
ContentTemplate="{TemplateBinding ContentTemplate}"
59+
Focusable="False"
60+
RecognizesAccessKey="True"
61+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
6762
</Grid>
6863
<ControlTemplate.Triggers>
6964
<Trigger Property="Button.IsDefaulted" Value="True">
@@ -82,31 +77,30 @@
8277
</ControlTemplate>
8378
</Setter.Value>
8479
</Setter>
80+
<Setter Property="VerticalContentAlignment" Value="Center" />
8581
</Style>
8682

8783
<Style TargetType="{x:Type controls:NotificationMessage}">
8884
<Setter Property="Template">
8985
<Setter.Value>
9086
<ControlTemplate TargetType="{x:Type controls:NotificationMessage}">
91-
<Border
92-
MinHeight="35"
93-
VerticalAlignment="Top"
94-
Background="{TemplateBinding Background}"
95-
BorderBrush="#882F2F2F"
96-
BorderThickness="0,0,0,1"
97-
SnapsToDevicePixels="True"
98-
UseLayoutRounding="True">
87+
<Border MinHeight="35"
88+
VerticalAlignment="Top"
89+
Background="{TemplateBinding Background}"
90+
BorderBrush="#882F2F2F"
91+
BorderThickness="0,0,0,1"
92+
SnapsToDevicePixels="True"
93+
UseLayoutRounding="True">
9994
<Grid>
10095
<Grid.Resources>
10196
<!-- Accent button style -->
10297
<Style BasedOn="{StaticResource NotificationMessageButtonStyle}" TargetType="{x:Type controls:NotificationMessageButton}">
10398
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=ButtonAccentBrush}" />
10499
</Style>
105100
<!-- Accent badge style -->
106-
<Style
107-
x:Key="NotificationBadgeAccentStyle"
108-
BasedOn="{StaticResource NotificationBadgeBaseStyle}"
109-
TargetType="{x:Type TextBlock}">
101+
<Style x:Key="NotificationBadgeAccentStyle"
102+
BasedOn="{StaticResource NotificationBadgeBaseStyle}"
103+
TargetType="{x:Type TextBlock}">
110104
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:NotificationMessage}}, Path=BadgeAccentBrush}" />
111105
</Style>
112106
</Grid.Resources>
@@ -117,11 +111,17 @@
117111
</Grid.ColumnDefinitions>
118112

119113
<!-- Badge -->
120-
<TextBlock
121-
Grid.Column="0"
122-
Style="{StaticResource NotificationBadgeAccentStyle}"
123-
Text="{TemplateBinding BadgeText}"
124-
Visibility="{TemplateBinding BadgeVisibility}" />
114+
<TextBlock Grid.Column="0"
115+
Style="{StaticResource NotificationBadgeAccentStyle}"
116+
Text="{TemplateBinding BadgeText}"
117+
Visibility="{TemplateBinding BadgeVisibility}" />
118+
119+
<!-- Overlay content -->
120+
<ContentControl Grid.Column="0"
121+
Grid.ColumnSpan="3"
122+
HorizontalAlignment="Stretch"
123+
VerticalAlignment="Stretch"
124+
Content="{TemplateBinding OverlayContent}" />
125125

126126
<!-- Header and message -->
127127
<Grid Grid.Column="1" Margin="10,8">
@@ -130,17 +130,15 @@
130130
<RowDefinition Height="*" />
131131
</Grid.RowDefinitions>
132132

133-
<TextBlock
134-
Grid.Row="0"
135-
Style="{StaticResource NotificationHeaderTextStyle}"
136-
Text="{TemplateBinding Header}"
137-
Visibility="{TemplateBinding HeaderVisibility}" />
133+
<TextBlock Grid.Row="0"
134+
Style="{StaticResource NotificationHeaderTextStyle}"
135+
Text="{TemplateBinding Header}"
136+
Visibility="{TemplateBinding HeaderVisibility}" />
138137

139-
<TextBlock
140-
Grid.Row="1"
141-
Style="{StaticResource NotificationMessageTextStyle}"
142-
Text="{TemplateBinding Message}"
143-
Visibility="{TemplateBinding MessageVisibility}" />
138+
<TextBlock Grid.Row="1"
139+
Style="{StaticResource NotificationMessageTextStyle}"
140+
Text="{TemplateBinding Message}"
141+
Visibility="{TemplateBinding MessageVisibility}" />
144142
</Grid>
145143

146144
<!-- Buttons -->
@@ -156,14 +154,6 @@
156154
</DataTemplate>
157155
</ItemsControl.ItemTemplate>
158156
</ItemsControl>
159-
160-
<!-- Overlay content -->
161-
<ContentControl
162-
Grid.Column="0"
163-
Grid.ColumnSpan="3"
164-
HorizontalAlignment="Stretch"
165-
VerticalAlignment="Stretch"
166-
Content="{TemplateBinding OverlayContent}" />
167157
</Grid>
168158
</Border>
169159
</ControlTemplate>
@@ -180,31 +170,29 @@
180170
</Setter.Value>
181171
</Setter>
182172
<Setter Property="SnapsToDevicePixels" Value="True" />
183-
<Setter Property="VerticalAlignment" Value="Top" />
184173
<Setter Property="Template">
185174
<Setter.Value>
186175
<ControlTemplate TargetType="{x:Type controls:NotificationMessageContainer}">
187176
<Grid>
188-
<Border
189-
x:Name="ItemsBorder"
190-
Margin="12,0,12,12"
191-
Padding="{TemplateBinding Padding}"
192-
Background="{TemplateBinding Background}"
193-
SnapsToDevicePixels="true"
194-
UseLayoutRounding="True">
177+
<Border x:Name="ItemsBorder"
178+
Margin="12,0,12,12"
179+
Padding="{TemplateBinding Padding}"
180+
Background="{TemplateBinding Background}"
181+
SnapsToDevicePixels="true"
182+
UseLayoutRounding="True">
195183
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
196184
<ItemsPresenter.Effect>
197-
<DropShadowEffect
198-
BlurRadius="10"
199-
Direction="270"
200-
Opacity="0.3"
201-
Color="Black" />
185+
<DropShadowEffect BlurRadius="10"
186+
Direction="270"
187+
Opacity="0.3"
188+
Color="Black" />
202189
</ItemsPresenter.Effect>
203190
</ItemsPresenter>
204191
</Border>
205192
</Grid>
206193
</ControlTemplate>
207194
</Setter.Value>
208195
</Setter>
196+
<Setter Property="VerticalAlignment" Value="Top" />
209197
</Style>
210198
</ResourceDictionary>

0 commit comments

Comments
 (0)