Merge with OUT-587 sync
authorThomas
Fri, 09 Aug 2019 16:07:35 +0200
branchsync
changeset 2702 4ebc6523e502
parent 2697 b9b470a40aec (current diff)
parent 2701 727366b902e3 (diff)
child 2703 2915c07d9628
child 2704 6efa9f0ab7ca
Merge with OUT-587
--- a/Resources/Dictionary.xaml	Fri Aug 09 12:49:04 2019 +0200
+++ b/Resources/Dictionary.xaml	Fri Aug 09 16:07:35 2019 +0200
@@ -351,4 +351,62 @@
         </Setter>
     </Style>
 
+    <!-- Style for the Unencrypted preview reply/forward buttons -->
+    <Style x:Key="StyleReplyButton"
+           TargetType="Button"
+           BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
+        <Setter Property="Padding"
+                Value="10,7" />
+        <Setter Property="BorderBrush"
+                Value="DarkGray" />
+        <Setter Property="Margin"
+                Value="0,0,0,0" />
+        <Setter Property="BorderThickness"
+                Value="1" />
+        <Setter Property="MinHeight"
+                Value="28" />
+        <Setter Property="MinWidth"
+                Value="80" />
+        <Setter Property="HorizontalContentAlignment"
+                Value="Center" />
+        <Setter Property="VerticalContentAlignment"
+                Value="Center" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="ButtonBase">
+                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                            BorderBrush="{TemplateBinding Border.BorderBrush}"
+                            Background="{TemplateBinding Panel.Background}"
+                            Name="border"
+                            SnapsToDevicePixels="True">
+                        <ContentPresenter RecognizesAccessKey="True"
+                                          Content="{TemplateBinding ContentControl.Content}"
+                                          ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
+                                          ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
+                                          Name="contentPresenter"
+                                          Margin="{TemplateBinding Control.Padding}"
+                                          HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
+                                          VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
+                                          SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
+                                          Focusable="False" />
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="UIElement.IsMouseOver"
+                                 Value="True">
+                            <Setter Property="Panel.Background"
+                                    TargetName="border"
+                                    Value="{x:Static SystemColors.GradientInactiveCaptionBrush}" />
+                        </Trigger>
+                        <Trigger Property="ButtonBase.IsPressed"
+                                 Value="True">
+                            <Setter Property="Panel.Background"
+                                    TargetName="border"
+                                    Value="{x:Static SystemColors.GradientActiveCaptionBrush}" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
 </ResourceDictionary>
\ No newline at end of file
--- a/UI/FormControlPreviewMessage.xaml	Fri Aug 09 12:49:04 2019 +0200
+++ b/UI/FormControlPreviewMessage.xaml	Fri Aug 09 16:07:35 2019 +0200
@@ -26,6 +26,11 @@
                 <local:IsListEmptyConverter />
                 <local:InvertBoolConverter />
             </local:ValueConverterGroup>
+            <local:ValueConverterGroup x:Key="IsListEmptyToInvertVisibility">
+                <local:IsListEmptyConverter />
+                <local:InvertBoolConverter />
+                <BooleanToVisibilityConverter />
+            </local:ValueConverterGroup>
             <local:ValueConverterGroup x:Key="IsStringEmptyToVisibility">
                 <local:IsStringEmptyConverter />
                 <BooleanToVisibilityConverter />
@@ -42,111 +47,179 @@
             </ResourceDictionary.MergedDictionaries>
         </ResourceDictionary>
     </UserControl.Resources>
-    <Grid Name="GridLayoutRoot"
-          Margin="5">
-        <Grid.RowDefinitions>
-            <RowDefinition Height="25" />
-            <RowDefinition Height="5" />
-            <RowDefinition Height="Auto" />
-            <RowDefinition Height="Auto" />
-            <RowDefinition Height="Auto" />
-            <RowDefinition Height="Auto" />
-            <RowDefinition Height="Auto" />
-            <RowDefinition Height="*" />
-        </Grid.RowDefinitions>
+    <DockPanel Name="DockPanelLayoutRoot"
+                Margin="5">
 
-        <!-- Buttons & preview text -->
-        <StackPanel Grid.Row="0"
-                    Orientation="Horizontal"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Stretch">
-            <Button Name="ButtonReply"
-                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
-                    Padding="{StaticResource ButtonPaddingStandard}"
-                    Margin="0"
-                    HorizontalContentAlignment="Center"
-                    VerticalContentAlignment="Center"
-                    Click="ButtonReply_Click"
-                    Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}">
-                <StackPanel Orientation="Horizontal">
-                    <Image Stretch="Uniform"
-                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReply.png"
-                           Margin="0,0,4,0" />
-                    <TextBlock VerticalAlignment="Center"
-                               FontFamily="Segoe UI"
-                               FontSize="12"
-                               Text="{x:Static p:Resources.PreviewMessage_ReplyText}" />
-                </StackPanel>
-            </Button>
-            <Button Name="ButtonReplyAll"
-                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
-                    Padding="{StaticResource ButtonPaddingStandard}"
-                    Margin="5,0,0,0"
-                    HorizontalContentAlignment="Center"
-                    VerticalContentAlignment="Center"
-                    Click="ButtonReplyAll_Click"
-                    Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}">
-                <StackPanel Orientation="Horizontal">
-                    <Image Stretch="Uniform"
-                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReplyAll.png"
-                           Margin="0,0,4,0" />
-                    <TextBlock VerticalAlignment="Center"
-                               FontFamily="Segoe UI"
-                               FontSize="12"
-                               Text="{x:Static p:Resources.PreviewMessage_ReplyAllText}" />
-                </StackPanel>
-            </Button>
-            <Button Name="ButtonForward"
-                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
-                    Padding="{StaticResource ButtonPaddingStandard}"
-                    Margin="5,0,0,0"
-                    HorizontalContentAlignment="Center"
-                    VerticalContentAlignment="Center"
-                    Click="ButtonForward_Click"
-                    Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}">
-                <StackPanel Orientation="Horizontal">
-                    <Image Stretch="Uniform"
-                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewForward.png"
-                           Margin="0,0,4,0" />
-                    <TextBlock VerticalAlignment="Center"
-                               FontFamily="Segoe UI"
-                               FontSize="12"
-                               Text="{x:Static p:Resources.PreviewMessage_ForwardText}" />
-                </StackPanel>
-            </Button>
-        </StackPanel>
-        <TextBlock Text="{x:Static p:Resources.PreviewMessage_PreviewText}"
+        <!--'Preview' text-->
+        <TextBlock DockPanel.Dock="Top"
+                   Text="{x:Static p:Resources.PreviewMessage_PreviewText}"
                    FontFamily="Segoe UI"
                    FontSize="12"
                    TextAlignment="Right"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    Margin="0"
-                   Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
+                   Visibility="{Binding IsNoteModeEnabled, Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
 
-        <!-- Message info header -->
-        <Grid Grid.Row="2">
+        <!--Subject-->
+        <TextBox DockPanel.Dock="Top"
+                 Background="Transparent"
+                 BorderThickness="0"
+                 IsReadOnly="True"
+                 IsTabStop="False"
+                 FontFamily="Segoe UI Semibold"
+                 FontSize="20"
+                 Margin="0,5"
+                 Text="{Binding Message.ShortMsg}"
+                 TextWrapping="NoWrap"
+                 HorizontalAlignment="Stretch"
+                 VerticalAlignment="Center" />
+
+        <!--Contact image, recipients and reply buttons-->
+        <Grid DockPanel.Dock="Top"
+              Name="GridContactRecipients"
+              Visibility="{Binding IsNoteModeEnabled, Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" >
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="Auto" />
-                <ColumnDefinition Width="20" />
                 <ColumnDefinition Width="Auto" />
+                <ColumnDefinition Width="*" />
             </Grid.ColumnDefinitions>
             <Grid.RowDefinitions>
-                <RowDefinition Height="Auto" />
-                <RowDefinition Height="Auto" />
-                <RowDefinition Height="Auto" />
+                <RowDefinition Height="Auto"/>
+                <RowDefinition Height="Auto"/>
+                <RowDefinition Height="Auto"/>
             </Grid.RowDefinitions>
 
-            <!--Image-->
-            <Image Grid.Row="0"
-                   Grid.RowSpan="3"
-                   Grid.Column="0"
-                   Stretch="Uniform"
-                   Source="pack://application:,,,/pEp;component/Resources/ImagePreviewContact.png"
-                   Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
+            <!--Contact image-->
+            <Canvas x:Name="CanvasContactName"
+                    Grid.Row="0"
+                    Grid.RowSpan="3"
+                    Grid.Column="0"
+                    Height="60"
+                    Width="60"
+                    Margin="0,0,5,0">
+                <Ellipse Name="EllipseContactImage"
+                         Width="48"
+                         Height="48"
+                         Fill="{Binding ContactIconBackground}"
+                         Canvas.Left="6"
+                         Canvas.Top="6"
+                         Panel.ZIndex="0"/>
+                <Grid Width="{Binding ActualWidth, ElementName=CanvasContactName}"
+                      Height="{Binding ActualHeight, ElementName=CanvasContactName}">
+                    <TextBlock Text="{Binding ContactIconText}"                           
+                           Foreground="White"
+                           FontFamily="Segoe UI Light"
+                           FontSize="20"
+                           Panel.ZIndex="1"
+                           HorizontalAlignment="Center"
+                           VerticalAlignment="Center"/>
+                </Grid>
+            </Canvas>
+
+            <!-- From recipient -->
+            <TextBox Grid.Row="0"
+                     Grid.Column="1"
+                     Background="Transparent"
+                     FontFamily="Segoe UI"
+                     FontSize="14"
+                     Foreground="DarkSlateGray"
+                     BorderThickness="0"
+                     IsReadOnly="True"
+                     IsTabStop="False"
+                     Text="{Binding FromRecipient, Mode=OneWay}"
+                     TextWrapping="NoWrap"
+                     HorizontalAlignment="Stretch"
+                     VerticalAlignment="Center" />
 
-            <!-- Date -->
-            <TextBox Grid.Row="0"
+            <!--Reply buttons-->
+            <StackPanel Grid.Row="0"
+                        Grid.Column="2"
+                    Orientation="Horizontal"
+                    HorizontalAlignment="Right"
+                    VerticalAlignment="Stretch">
+                <Button Name="ButtonReply"
+                    Style="{StaticResource StyleReplyButton}"                    
+                    Click="ButtonReply_Click">
+                    <StackPanel Orientation="Horizontal">
+                        <Image Stretch="Uniform"
+                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReply.png"
+                           Margin="0,0,4,0" />
+                        <TextBlock VerticalAlignment="Center"
+                               FontFamily="Segoe UI"
+                               FontSize="12"
+                               Text="{x:Static p:Resources.PreviewMessage_ReplyText}" />
+                    </StackPanel>
+                </Button>
+                <Button Name="ButtonReplyAll"
+                    Style="{StaticResource StyleReplyButton}"
+                    Click="ButtonReplyAll_Click">
+                    <StackPanel Orientation="Horizontal">
+                        <Image Stretch="Uniform"
+                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReplyAll.png"
+                           Margin="0,0,4,0" />
+                        <TextBlock VerticalAlignment="Center"
+                               FontFamily="Segoe UI"
+                               FontSize="12"
+                               Text="{x:Static p:Resources.PreviewMessage_ReplyAllText}" />
+                    </StackPanel>
+                </Button>
+                <Button Name="ButtonForward"
+                    Style="{StaticResource StyleReplyButton}" 
+                    Click="ButtonForward_Click">
+                    <StackPanel Orientation="Horizontal">
+                        <Image Stretch="Uniform"
+                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewForward.png"
+                           Margin="0,0,4,0" />
+                        <TextBlock VerticalAlignment="Center"
+                               FontFamily="Segoe UI"
+                               FontSize="12"
+                               Text="{x:Static p:Resources.PreviewMessage_ForwardText}" />
+                    </StackPanel>
+                </Button>
+            </StackPanel>
+
+            <!--'To' recipients-->
+            <StackPanel Grid.Row="1" 
+                        Grid.Column="1"
+                        Orientation="Horizontal">
+
+                <!--Recipients "To" text-->
+                <TextBlock Margin="0,0,10,0"
+                           Background="Transparent"
+                           FontFamily="Segoe UI"
+                           FontSize="11"
+                           Foreground="Gray"
+                           Text="{x:Static p:Resources.PreviewMessage_ToText}"
+                           TextWrapping="NoWrap"
+                           HorizontalAlignment="Stretch"
+                           VerticalAlignment="Center" />
+
+                <ItemsControl ItemsSource="{Binding Message.To}"
+                              VerticalAlignment="Center">
+                    <ItemsControl.ItemsPanel>
+                        <ItemsPanelTemplate>
+                            <WrapPanel />
+                        </ItemsPanelTemplate>
+                    </ItemsControl.ItemsPanel>
+                    <ItemsControl.ItemTemplate>
+                        <DataTemplate>
+                            <TextBlock Margin="0,0,10,0"
+                                       Background="Transparent"
+                                       FontFamily="Segoe UI"
+                                       FontSize="11"
+                                       Foreground="DarkSlateGray"
+                                       Text="{Binding Address}"
+                                       TextWrapping="NoWrap"
+                                       HorizontalAlignment="Stretch"
+                                       VerticalAlignment="Center" />
+                        </DataTemplate>
+                    </ItemsControl.ItemTemplate>
+                </ItemsControl>
+            </StackPanel>
+
+            <!--Date-->
+            <TextBox Grid.Row="1"
                      Grid.Column="2"
                      Background="Transparent"
                      BorderThickness="0"
@@ -156,171 +229,99 @@
                      FontSize="11"
                      Foreground="DarkSlateGray"
                      TextWrapping="NoWrap"
-                     HorizontalAlignment="Stretch"
+                     HorizontalAlignment="Right"
                      VerticalAlignment="Center"
-                     Text="{Binding Path='Date', Mode=OneWay}"
-                     Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
+                     Text="{Binding Path='Date', Mode=OneWay}" />
+
+
+            <!--'Cc' recipients-->
+            <StackPanel Grid.Row="2" 
+                        Grid.Column="1"
+                        Orientation="Horizontal"
+                        Visibility="{Binding Message.Cc, Converter={StaticResource IsListEmptyToInvertVisibility}}">
+
+                <!--Recipients "Cc" text-->
+                <TextBlock Margin="0,0,10,0"
+                           Background="Transparent"
+                           FontFamily="Segoe UI"
+                           FontSize="11"
+                           Foreground="Gray"
+                           Text="{x:Static p:Resources.PreviewMessage_CcText}"
+                           TextWrapping="NoWrap"
+                           HorizontalAlignment="Stretch"
+                           VerticalAlignment="Center" />
 
-            <!-- From recipient -->
-            <TextBox Grid.Row="1"
-                     Grid.Column="2"
-                     Background="Transparent"
-                     Margin="0,5,0,5"
-                     FontFamily="Segoe UI Light"
-                     FontSize="22"
-                     Foreground="DarkSlateGray"
-                     BorderThickness="0"
-                     IsReadOnly="True"
-                     IsTabStop="False"
-                     Text="{Binding Path='FromRecipient', Mode=OneWay}"
-                     TextWrapping="NoWrap"
-                     HorizontalAlignment="Stretch"
-                     VerticalAlignment="Center"
-                     Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
-
-            <!-- Subject -->
-            <TextBox Grid.Row="2"
-                     Grid.Column="2"
-                     Background="Transparent"
-                     BorderThickness="0"
-                     IsReadOnly="True"
-                     IsTabStop="False"
-                     FontFamily="Segoe UI Semibold"
-                     FontSize="15"
-                     Text="{Binding Path='Message.ShortMsg', Mode=OneWay}"
-                     TextWrapping="NoWrap"
-                     HorizontalAlignment="Stretch"
-                     VerticalAlignment="Center"
-                     Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
-
+                <ItemsControl ItemsSource="{Binding Message.Cc}">
+                    <ItemsControl.ItemsPanel>
+                        <ItemsPanelTemplate>
+                            <WrapPanel />
+                        </ItemsPanelTemplate>
+                    </ItemsControl.ItemsPanel>
+                    <ItemsControl.ItemTemplate>
+                        <DataTemplate>
+                            <TextBlock Margin="0,0,10,0"
+                           Background="Transparent"
+                           FontFamily="Segoe UI"
+                           FontSize="11"
+                           Foreground="DarkSlateGray"
+                           Text="{Binding Address}"
+                           TextWrapping="NoWrap"
+                           HorizontalAlignment="Stretch"
+                           VerticalAlignment="Center" />
+                        </DataTemplate>
+                    </ItemsControl.ItemTemplate>
+                </ItemsControl>
+            </StackPanel>
         </Grid>
 
-        <Grid Grid.Row="3"
-              Grid.Column="0"
-              Grid.ColumnSpan="3"
-              Margin="0,5,0,5">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="Auto" />
-                <ColumnDefinition Width="Auto" />
-            </Grid.ColumnDefinitions>
-
-            <!--Recipients "To" text-->
-            <TextBlock Grid.Column="0"
-                       Margin="0,0,10,0"
-                       Background="Transparent"
-                       FontFamily="Segoe UI"
-                       FontSize="11"
-                       Foreground="DarkSlateGray"
-                       Text="{x:Static p:Resources.PreviewMessage_ToText}"
-                       TextWrapping="NoWrap"
-                       HorizontalAlignment="Stretch"
-                       VerticalAlignment="Center"
-                       Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
-
-            <!--To Recipients-->
-            <TextBlock Grid.Column="1"
-                       Background="Transparent"
-                       FontFamily="Segoe UI"
-                       FontSize="11"
-                       Foreground="DarkSlateGray"
-                       Text="{Binding Path='ToRecipients', Mode=OneWay}"
-                       TextWrapping="NoWrap"
-                       HorizontalAlignment="Stretch"
-                       VerticalAlignment="Center" />
-        </Grid>
-
-        <Grid Grid.Row="4"
-              Grid.Column="0"
-              Grid.ColumnSpan="3"
-              Margin="0,5,0,5">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="Auto" />
-                <ColumnDefinition Width="Auto" />
-            </Grid.ColumnDefinitions>
-
-            <!--Recipients "Cc" text-->
-            <TextBlock Grid.Column="0"
-                       Margin="0,0,10,0"
-                       Background="Transparent"
-                       FontFamily="Segoe UI"
-                       FontSize="11"
-                       Foreground="DarkSlateGray"
-                       Text="{x:Static p:Resources.PreviewMessage_CcText}"
-                       TextWrapping="NoWrap"
-                       HorizontalAlignment="Stretch"
-                       VerticalAlignment="Center"
-                       Visibility="{Binding Path=CcRecipients, Mode=OneWay, Converter={StaticResource IsStringNotEmptyToVisibility}}" />
-
-            <!--Cc Recipients-->
-            <TextBlock Grid.Column="1"
-                       Background="Transparent"
-                       FontFamily="Segoe UI"
-                       FontSize="11"
-                       Foreground="DarkSlateGray"
-                       Text="{Binding Path='CcRecipients', Mode=OneWay}"
-                       TextWrapping="NoWrap"
-                       HorizontalAlignment="Stretch"
-                       VerticalAlignment="Center"
-                       Visibility="{Binding Path=CcRecipients, Mode=OneWay, Converter={StaticResource IsStringNotEmptyToVisibility}}" />
-        </Grid>
-
-        <!-- Attachments -->
-        <Grid Grid.Row="5">
-            <Grid.RowDefinitions>
-                <RowDefinition Height="Auto" />
-                <RowDefinition Height="Auto" />
-                <RowDefinition Height="Auto" />
-            </Grid.RowDefinitions>
-            <Separator Grid.Row="0"
-                       Margin="0,3,0,3"
-                       Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
-            <ItemsControl Grid.Row="1"
-                          HorizontalAlignment="Stretch"
-                          VerticalAlignment="Top"
-                          ItemsSource="{Binding Path='Message.Attachments', Mode=OneWay}">
-                <ItemsControl.Visibility>
-                    <MultiBinding Converter="{StaticResource MultiBooleanToVisibility}">
-                        <Binding Path="Message.Attachments"
+        <!--Attachments-->
+        <ItemsControl DockPanel.Dock="Top"
+                      HorizontalAlignment="Stretch"
+                      VerticalAlignment="Top"
+                      ItemsSource="{Binding Message.Attachments, Mode=OneWay}">
+            <ItemsControl.Visibility>
+                <MultiBinding Converter="{StaticResource MultiBooleanToVisibility}">
+                    <Binding Path="Message.Attachments"
                                  Mode="OneWay"
                                  Converter="{StaticResource IsListEmptyToInvertBool}" />
-                        <Binding Path="Message.Attachments"
+                    <Binding Path="Message.Attachments"
                                  Mode="OneWay"
                                  Converter="{StaticResource HasNonInlineAttachments}" />
-                        <Binding Path="IsNoteModeEnabled"
+                    <Binding Path="IsNoteModeEnabled"
                                  Mode="OneWay"
                                  Converter="{StaticResource InvertBool}" />
-                    </MultiBinding>
-                </ItemsControl.Visibility>
-                <ItemsControl.ItemTemplate>
-                    <DataTemplate>
-                        <StackPanel Visibility="{Binding Path=ContentId, Converter={StaticResource IsStringEmptyToVisibility}}">
-                            <Border BorderBrush="DarkGray"
+                </MultiBinding>
+            </ItemsControl.Visibility>
+            <ItemsControl.ItemTemplate>
+                <DataTemplate>
+                    <StackPanel Visibility="{Binding Path=ContentId, Converter={StaticResource IsStringEmptyToVisibility}}">
+                        <Border BorderBrush="DarkGray"
                                     BorderThickness="1"
                                     Height="35"
                                     Width="180"
                                     Margin="2">
-                                <Grid>
-                                    <Grid.ColumnDefinitions>
-                                        <ColumnDefinition Width="*" />
-                                        <ColumnDefinition Width="20" />
-                                    </Grid.ColumnDefinitions>
-                                    <Grid.RowDefinitions>
-                                        <RowDefinition Height="*" />
-                                    </Grid.RowDefinitions>
-                                    <ContentControl MouseDoubleClick="ButtonAttachment_DoubleClick">
-                                        <Grid Grid.Column="0"
+                            <Grid>
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition Width="*" />
+                                    <ColumnDefinition Width="20" />
+                                </Grid.ColumnDefinitions>
+                                <Grid.RowDefinitions>
+                                    <RowDefinition Height="*" />
+                                </Grid.RowDefinitions>
+                                <ContentControl MouseDoubleClick="ButtonAttachment_DoubleClick">
+                                    <Grid Grid.Column="0"
                                               Grid.Row="0">
-                                            <Grid.ColumnDefinitions>
-                                                <ColumnDefinition Width="30" />
-                                                <ColumnDefinition Width="*" />
-                                            </Grid.ColumnDefinitions>
-                                            <Grid.RowDefinitions>
-                                                <RowDefinition Height="*" />
-                                                <RowDefinition Height="*" />
-                                            </Grid.RowDefinitions>
+                                        <Grid.ColumnDefinitions>
+                                            <ColumnDefinition Width="30" />
+                                            <ColumnDefinition Width="*" />
+                                        </Grid.ColumnDefinitions>
+                                        <Grid.RowDefinitions>
+                                            <RowDefinition Height="*" />
+                                            <RowDefinition Height="*" />
+                                        </Grid.RowDefinitions>
 
-                                            <!-- File icon -->
-                                            <Image Grid.Column="0"
+                                        <!-- File icon -->
+                                        <Image Grid.Column="0"
                                                    Grid.Row="0"
                                                    Grid.RowSpan="2"
                                                    Stretch="Uniform"
@@ -329,27 +330,27 @@
                                                    VerticalAlignment="Stretch"
                                                    Margin="5" />
 
-                                            <!-- File name and size -->
-                                            <TextBlock Grid.Column="1"
+                                        <!-- File name and size -->
+                                        <TextBlock Grid.Column="1"
                                                        Grid.Row="0"
                                                        HorizontalAlignment="Stretch"
                                                        VerticalAlignment="Bottom"
                                                        Text="{Binding Path='FileName', Mode=OneWay}" />
-                                            <TextBlock Grid.Column="1"
+                                        <TextBlock Grid.Column="1"
                                                        Grid.Row="1"
                                                        HorizontalAlignment="Stretch"
                                                        VerticalAlignment="Center"
                                                        Text="{Binding Path='FileSizeString', Mode=OneWay}" />
-                                        </Grid>
-                                    </ContentControl>
-                                    <Grid Grid.Column="1"
+                                    </Grid>
+                                </ContentControl>
+                                <Grid Grid.Column="1"
                                           Grid.Row="0">
-                                        <!-- Attachment actions -->
-                                        <!-- The button needs to pass both the PEPAttachment and DataContext to the ContextMenu
+                                    <!-- Attachment actions -->
+                                    <!-- The button needs to pass both the PEPAttachment and DataContext to the ContextMenu
                                      This is a little tricky because the ContextMenu is outside of the visual tree. 
                                      In order to do this, the Button Tag is set to the DataContext and the Tag is the UserControl DataContext.
                                      You cannot Set the Button DataContext to the UserControl DataContext or the PEPAttachment is lost. -->
-                                        <Button Name="ButtonAttachment"
+                                    <Button Name="ButtonAttachment"
                                                 Grid.Column="0"
                                                 Grid.Row="0"
                                                 Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
@@ -362,58 +363,40 @@
                                                 Tag="{Binding Path='DataContext', RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
                                                 DataContext="{Binding Path=.}"
                                                 Click="ButtonAttachment_Click">
-                                            <Button.ContextMenu>
-                                                <ContextMenu Name="ContextMenuAttachment"
+                                        <Button.ContextMenu>
+                                            <ContextMenu Name="ContextMenuAttachment"
                                                              Placement="Bottom"
                                                              DataContext="{Binding Path='PlacementTarget', RelativeSource={RelativeSource Self}}">
-                                                    <MenuItem Header='{x:Static p:Resources.PreviewMessage_OpenText}'
+                                                <MenuItem Header='{x:Static p:Resources.PreviewMessage_OpenText}'
                                                               Tag="{Binding Path='DataContext'}"
                                                               Click="MenuItemOpen_Click" />
-                                                    <Separator />
-                                                    <MenuItem Header='{x:Static p:Resources.PreviewMessage_SaveAsText}'
+                                                <Separator />
+                                                <MenuItem Header='{x:Static p:Resources.PreviewMessage_SaveAsText}'
                                                               Tag="{Binding Path='DataContext'}"
                                                               Click="MenuItemSaveAs_Click" />
-                                                </ContextMenu>
-                                            </Button.ContextMenu>
-                                            <TextBlock Text="▼"
+                                            </ContextMenu>
+                                        </Button.ContextMenu>
+                                        <TextBlock Text="▼"
                                                        TextAlignment="Center"
                                                        FontFamily="Arial"
                                                        FontSize="9"
                                                        Foreground="DarkGray" />
-                                        </Button>
-                                    </Grid>
+                                    </Button>
                                 </Grid>
-                            </Border>
-                        </StackPanel>
-                    </DataTemplate>
-                </ItemsControl.ItemTemplate>
-                <ItemsControl.ItemsPanel>
-                    <ItemsPanelTemplate>
-                        <WrapPanel Orientation="Horizontal" />
-                    </ItemsPanelTemplate>
-                </ItemsControl.ItemsPanel>
-            </ItemsControl>
-            <Separator Grid.Row="2"
-                       Margin="0,3,0,3"
-                       Foreground="DarkSlateGray">
-                <Separator.Visibility>
-                    <MultiBinding Converter="{StaticResource MultiBooleanToVisibility}">
-                        <Binding Path="Message.Attachments"
-                                 Mode="OneWay"
-                                 Converter="{StaticResource IsListEmptyToInvertBool}" />
-                        <Binding Path="Message.Attachments"
-                                 Mode="OneWay"
-                                 Converter="{StaticResource HasNonInlineAttachments}" />
-                        <Binding Path="IsNoteModeEnabled"
-                                 Mode="OneWay"
-                                 Converter="{StaticResource InvertBool}" />
-                    </MultiBinding>
-                </Separator.Visibility>
-            </Separator>
-        </Grid>
+                            </Grid>
+                        </Border>
+                    </StackPanel>
+                </DataTemplate>
+            </ItemsControl.ItemTemplate>
+            <ItemsControl.ItemsPanel>
+                <ItemsPanelTemplate>
+                    <WrapPanel Orientation="Horizontal" />
+                </ItemsPanelTemplate>
+            </ItemsControl.ItemsPanel>
+        </ItemsControl>
 
-        <TextBlock x:Name="RemoteImagesWarning"
-                   Grid.Row="6"
+        <TextBlock x:Name="RemoteImagesWarning" 
+                   DockPanel.Dock="Top"
                    Visibility="Collapsed"
                    Padding="5"
                    Text="{x:Static p:Resources.PreviewMessage_RemoteImagesWarningText}"
@@ -434,11 +417,12 @@
         </TextBlock>
 
         <WebBrowser x:Name="WebBrowser"
-                    Grid.Row="7"
+                    DockPanel.Dock="Top"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Stretch"
                     Margin="0,10,0,0"
                     Navigating="WebBrowser_Navigating"
                     Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
-    </Grid>
+
+    </DockPanel>
 </UserControl>
\ No newline at end of file
--- a/UI/FormControlPreviewMessage.xaml.cs	Fri Aug 09 12:49:04 2019 +0200
+++ b/UI/FormControlPreviewMessage.xaml.cs	Fri Aug 09 16:07:35 2019 +0200
@@ -4,9 +4,11 @@
 using System.Diagnostics;
 using System.IO;
 using System.Net;
+using System.Runtime.CompilerServices;
 using System.Text.RegularExpressions;
 using System.Windows;
 using System.Windows.Controls;
+using System.Windows.Media;
 using Outlook = Microsoft.Office.Interop.Outlook;
 
 namespace pEp.UI
@@ -116,8 +118,6 @@
                 this.ButtonReply = null;
                 this.ButtonReplyAll = null;
                 this.displayState = null;
-                this.displayState = null;
-                this.GridLayoutRoot = null;
                 this.RemoteImagesWarning = null;
 
                 this.DeleteTempHtmlFiles();
@@ -414,7 +414,6 @@
             }
 
             this.PropertyChanged?.Invoke(this, e);
-            return;
         }
 
         /// <summary>
@@ -423,7 +422,6 @@
         private void ButtonForward_Click(object sender, RoutedEventArgs e)
         {
             this.Forward?.Invoke(this, new RoutedEventArgs());
-            return;
         }
 
         /// <summary>
@@ -432,7 +430,6 @@
         private void ButtonReply_Click(object sender, RoutedEventArgs e)
         {
             this.Reply?.Invoke(this, new RoutedEventArgs());
-            return;
         }
 
         /// <summary>
@@ -455,8 +452,6 @@
             menu.PlacementTarget = button;
             menu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
             menu.IsOpen = true;
-
-            return;
         }
 
         /// <summary>
@@ -470,9 +465,8 @@
             {
                 ((PEPAttachment)contentControl.DataContext).Open();
             }
-            return;
+        }
 
-        }
         /// <summary>
         /// Event handler for when the Open context menu item is clicked for an attachment.
         /// </summary>
@@ -484,8 +478,6 @@
             {
                 ((PEPAttachment)menuItem.Tag).Open();
             }
-
-            return;
         }
 
         /// <summary>
@@ -580,12 +572,8 @@
             /// </summary>
             public event PropertyChangedEventHandler PropertyChanged;
 
-            private string     _CcRecipients;
-            private string     _Date;
-            private string     _FromRecipient;
-            private bool       _IsNoteModeEnabled;
+            private bool _IsNoteModeEnabled;
             private PEPMessage _Message;
-            private string     _ToRecipients;
 
             /**************************************************************
              * 
@@ -608,30 +596,25 @@
              *************************************************************/
 
             /// <summary>
-            /// Gets the formatted Cc recipients string of the message.
-            /// This is a dependent property set through Message.
+            /// Gets the background color of the Contact icon.
             /// </summary>
-            public string CcRecipients
-            {
-                get { return this._CcRecipients; }
-            }
+            public SolidColorBrush ContactIconBackground { get; private set; }
+
+            /// <summary>
+            /// Gets the text to show in the Contact icon.
+            /// </summary>
+            public string ContactIconText { get; private set; }
 
             /// <summary>
             /// Gets the formatted date string of the message.
             /// This is a dependent property set through Message.
             /// </summary>
-            public string Date
-            {
-                get { return (this._Date); }
-            }
+            public string Date { get; private set; }
 
             /// <summary>
             /// Gets the To recipient
             /// </summary>
-            public string FromRecipient
-            {
-                get { return (this._FromRecipient); }
-            }
+            public string FromRecipient { get; private set; }
 
             /// <summary>
             /// Gets or sets whether note mode is enabled.
@@ -639,11 +622,11 @@
             /// </summary>
             public bool IsNoteModeEnabled
             {
-                get { return (this._IsNoteModeEnabled); }
+                get => this._IsNoteModeEnabled;
                 set
                 {
                     this._IsNoteModeEnabled = value;
-                    this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
+                    this.OnPropertyChanged();
 
                     this.CalcDependentProperties();
                 }
@@ -654,11 +637,11 @@
             /// </summary>
             public PEPMessage Message
             {
-                get { return (this._Message); }
+                get => this._Message;
                 set
                 {
                     this._Message = value;
-                    this.RaisePropertyChangedEvent(nameof(this.Message));
+                    this.OnPropertyChanged();
 
                     this.CalcDependentProperties();
                 }
@@ -669,15 +652,6 @@
             /// </summary>
             public string OriginalEntryId { get; set; } = null;
 
-            /// <summary>
-            /// Gets the formatted To recipients string of the message.
-            /// This is a dependent property set through Message.
-            /// </summary>
-            public string ToRecipients
-            {
-                get { return (this._ToRecipients); }
-            }
-
             /**************************************************************
              * 
              * Methods
@@ -688,10 +662,9 @@
             /// Raises the property changed event, if possible, with the given arguments.
             /// </summary>
             /// <param name="propertyName">The name of the property that changed.</param>
-            private void RaisePropertyChangedEvent(string propertyName)
+            protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
             {
                 this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
-                return;
             }
 
             /// <summary>
@@ -700,16 +673,11 @@
             public void Reset()
             {
                 // Set independent properties
-                this._IsNoteModeEnabled = true;
-                this._Message = null;
-
-                this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
-                this.RaisePropertyChangedEvent(nameof(this.Message));
+                this.IsNoteModeEnabled = true;
+                this.Message = null;
 
                 // Set dependent properties -- raises own events
                 this.CalcDependentProperties();
-
-                return;
             }
 
             /// <summary>
@@ -718,59 +686,37 @@
             /// </summary>
             private void CalcDependentProperties()
             {
-                string recipientText = string.Empty;
+                // Date
+                this.Date = this._Message?.SentOn?.ToString("g", Globals.ThisAddIn.GetActiveUICulture());
+                this.OnPropertyChanged(nameof(this.Date));
 
-                // Date
-                this._Date = this._Message?.SentOn?.ToString("g", Globals.ThisAddIn.GetActiveUICulture());
-                this.RaisePropertyChangedEvent(nameof(this.Date));
+                // From recipient
+                this.FromRecipient = this._Message?.From?.UserName ?? this.Message?.From?.Address;
+                this.OnPropertyChanged(nameof(this.FromRecipient));
 
-                // Recipients
-                this._ToRecipients = null;
-                this._CcRecipients = null;
+                // Contact Icon color
+                this.ContactIconBackground = (SolidColorBrush)new BrushConverter().ConvertFromString("#03AA4B");
+                this.OnPropertyChanged(nameof(this.ContactIconBackground));
 
-                // To recipients
-                for (int i = 0; i < this._Message?.To?.Count; i++)
+                // Contact Icon text
+                string contactIconText = null;
+                try
                 {
-                    if (i == (this._Message.To.Count - 1))
+                    string[] initials = this.FromRecipient?.ToUpperInvariant()?.Split(' ');
+                    if (initials?.Length > 0)
                     {
-                        recipientText += this._Message.To[i].ToDisplayString();
-                    }
-                    else
-                    {
-                        recipientText += this._Message.To[i].ToDisplayString() + "; ";
+                        for (int i = 0; i < initials?.Length; i++)
+                        {
+                            contactIconText += initials[i][0];
+                        }
                     }
                 }
-                this._ToRecipients = recipientText;
-                this.RaisePropertyChangedEvent(nameof(this.ToRecipients));
-
-                // Add any Cc (skip Bcc)
-                recipientText = string.Empty;
-                for (int i = 0; i < this._Message?.Cc?.Count; i++)
+                catch (Exception ex)
                 {
-                    if (i == (this._Message.Cc.Count - 1))
-                    {
-                        recipientText += this._Message.Cc[i].ToDisplayString();
-                    }
-                    else
-                    {
-                        recipientText += this._Message.Cc[i].ToDisplayString() + "; ";
-                    }
+                    Log.Error("FormControlPreviewMessage.CalcDependentProperties: Error getting initials. " + ex.ToString());
                 }
-
-                this._CcRecipients = recipientText;
-                this.RaisePropertyChangedEvent(nameof(this.CcRecipients));
-
-                // From recipient
-                this._FromRecipient = this._Message?.From?.UserName;
-                if (string.IsNullOrEmpty(this._FromRecipient))
-                {
-                    this._FromRecipient = this._Message?.From?.Address;
-                }
-                else
-                {
-                    this._FromRecipient += string.Concat(" <", this._Message?.From?.Address, ">");
-                }
-                this.RaisePropertyChangedEvent(nameof(this.FromRecipient));
+                this.ContactIconText = contactIconText;
+                this.OnPropertyChanged(nameof(this.ContactIconText));
             }
 
             /// <summary>
@@ -779,26 +725,10 @@
             /// </summary>
             public void SetNote(string note = null)
             {
-                /* Ignore the following which aren't needed
-                 *  - ForwardText
-                 *  - OpenText
-                 *  - PreviewText
-                 *  - ReplyAllText
-                 *  - ReplyText
-                 *  - SaveAsText
-                 */
-
-                this._Date = null;
-                this._IsNoteModeEnabled = true;
-                this._Message = null;
-                this._ToRecipients = note;
-
-                this.RaisePropertyChangedEvent(nameof(this.Date));
-                this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
-                this.RaisePropertyChangedEvent(nameof(this.Message));
-                this.RaisePropertyChangedEvent(nameof(this.ToRecipients));
-
-                return;
+                this.Date = null;
+                this.IsNoteModeEnabled = true;
+                this.Message = null;
+                this.FromRecipient = note;
             }
 
             /// <summary>
@@ -808,11 +738,8 @@
             /// <param name="message">The message to set to the UI.</param>
             public void SetMessage(PEPMessage message)
             {
-                this._IsNoteModeEnabled = false;
-                this._Message = message;
-
-                this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
-                this.RaisePropertyChangedEvent(nameof(this.Message));
+                this.IsNoteModeEnabled = false;
+                this.Message = message;
 
                 this.CalcDependentProperties();
             }