Skip to content

Commit

Permalink
Merge pull request #221 from haevg-rz/MinorUIAdjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
KaHBrat committed Jul 31, 2020
2 parents 6cf196d + b0ac527 commit 7306774
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 44 deletions.
72 changes: 39 additions & 33 deletions TrustCenterSearch.Presentation/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@
Height="auto"
Text="{Binding AddTrustCenterName, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding UserInputIsEnabled}"
Width="200"
Width="200"
HorizontalAlignment="Right"
ToolTip="Enter a name that describes the collection of certificates you want to import"/>
ToolTip="Enter a name that describes the collection of certificates you want to import" />

<TextBox Grid.Column="1" Grid.Row="1" Margin="0,5,10,5" BorderBrush="Transparent"
Padding="3"
Height="auto"
Text="{Binding AddTrustCenterUrl, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding UserInputIsEnabled}"
Width="200"
Width="200"
HorizontalAlignment="Right"
ToolTip="Enter a url that leads to a file containing hashed x509 certificates"/>
ToolTip="Enter a url that leads to a file containing hashed x509 certificates" />

<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" Style="{StaticResource AddButtonStyle}"
Command="{Binding AddTrustCenterButtonCommand}"
Expand Down Expand Up @@ -159,7 +159,7 @@
<ImageBrush ImageSource="/Resources/Images/loadIcon.png" />
</Button.Background>
</Button>
<Button Style="{DynamicResource BinImageStyle}"
<Button Style="{DynamicResource DeleteTrustCenterImageStyle}"
CommandParameter="{Binding}"
Command="{Binding Source={StaticResource ViewModel}, Path=DeleteTrustCenterFromHistoryCommand}">
<Button.Background>
Expand Down Expand Up @@ -202,12 +202,13 @@
<StackPanel Grid.Column="2" Grid.Row="0" Margin="10,10,27,0">
<Grid>
<TextBox Name="SearchBar" IsEnabled="{Binding UserInputIsEnabled}" Height="30" FontSize="15"
Padding="0,4,0,0" KeyUp="WatermarkVisibilityConverter">
Padding="4" TextChanged="SearchBar_OnTextChanged" KeyUp="WatermarkVisibilityConverter">
<TextBox.Text>
<Binding Path="SearchBarInput" Delay="300" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" />
</TextBox.Text>
</TextBox>
<TextBlock Grid.Row="0" FontSize="15" FontWeight="Light" Padding="4" FontStyle="Oblique" Foreground="Gray"
<TextBlock Grid.Row="0" FontSize="15" FontWeight="Light" Padding="8,4,4,4" FontStyle="Italic"
Foreground="Gray"
Name="SearchWatermark"
Text="Search" HorizontalAlignment="Left" Visibility="Visible" IsHitTestVisible="False" />
</Grid>
Expand All @@ -219,16 +220,38 @@
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type coreModels:Certificate}">
<Grid Margin="0,10,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox Grid.Row="0" Grid.Column="0"
Text="{Binding Subject}"
Foreground="{Binding Subject, Converter={StaticResource HighlightConverter}, ConverterParameter={x:Reference SearchBar}}"
Style="{StaticResource SearchResultSubjectTextBoxStyle}" />
<Grid Grid.Row="1">
<Button Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"
IsEnabled="{Binding Source={StaticResource ViewModel}, Path=UserInputIsEnabled}"
Style="{DynamicResource CopyToClipboardButtonStyle}"
Command="{Binding Source={StaticResource ViewModel}, Path=CopyToClipboardCommand}"
CommandParameter="{Binding}">
<Button.Background>
<ImageBrush ImageSource="/Resources/Images/copy.png" />
</Button.Background>
</Button>
<Grid Grid.Row="0" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0"
Text="{Binding Subject}"
Foreground="{Binding Subject, Converter={StaticResource HighlightConverter}, ConverterParameter={x:Reference SearchBar}}"
Style="{StaticResource SearchResultSubjectTextBoxStyle}" />
<TextBox Grid.Column="1" Text="{Binding TrustCenterName}"
Style="{StaticResource SearchResultTrustCenterNameTextBoxStyle}" />
</Grid>

<Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
Expand All @@ -242,11 +265,11 @@

<TextBox Grid.Column="0" Style="{StaticResource SearchResultValidityCaptionTextBoxStyle}" />
<WrapPanel Grid.Column="1" Margin="0,0,10,0">
<TextBlock Text="{Binding NotBefore}"
Foreground="{Binding NotBefore, Converter={StaticResource HighlightConverter}, ConverterParameter={x:Reference SearchBar}}" />
<TextBox BorderThickness="0" Text="{Binding NotBefore}"
Foreground="{Binding NotBefore, Converter={StaticResource HighlightConverter}, ConverterParameter={x:Reference SearchBar}}" />
<TextBlock Text=" - " />
<TextBlock Text="{Binding NotAfter}"
Foreground="{Binding NotAfter, Converter={StaticResource HighlightConverter}, ConverterParameter={x:Reference SearchBar}}" />
<TextBox BorderThickness="0" Text="{Binding NotAfter}"
Foreground="{Binding NotAfter, Converter={StaticResource HighlightConverter}, ConverterParameter={x:Reference SearchBar}}" />
</WrapPanel>

<TextBox Grid.Column="2" Style="{StaticResource SearchResultKeylengthCaptionTextBoxStyle}" />
Expand All @@ -270,23 +293,6 @@
Style="{StaticResource SearchResultSerialNumberResultTextBoxStyle}"
Foreground="{Binding SerialNumber, Converter={StaticResource HighlightConverter}, ConverterParameter={x:Reference SearchBar}}" />
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="1" Text="{Binding TrustCenterName}"
Style="{StaticResource SearchResultTrustCenterNameTextBoxStyle}" />
<Button IsEnabled="{Binding Source={StaticResource ViewModel}, Path=UserInputIsEnabled}"
Grid.Column="2" Style="{StaticResource CopyToClipboardButtonStyle}"
Command="{Binding Source={StaticResource ViewModel}, Path=CopyToClipboardCommand}"
CommandParameter="{Binding}">
<Button.Background>
<ImageBrush ImageSource="/Resources/Images/copy.png" />
</Button.Background>
</Button>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
Expand Down
8 changes: 8 additions & 0 deletions TrustCenterSearch.Presentation/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace TrustCenterSearch.Presentation
Expand All @@ -24,5 +25,12 @@ private void WatermarkVisibilityConverter(object sender, KeyEventArgs e)

this.SearchWatermark.Visibility = Visibility.Collapsed;
}

private void SearchBar_OnTextChanged(object sender, TextChangedEventArgs e)
{
/*sender as TextBox
this.DataContext as ViewModel*/

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TrustCenterSearch.Presentation.Resources.Styles">

<ImageBrush x:Key="CopyImage" ImageSource="/Resources/Images/copy.png" Stretch="Uniform" />

<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD" />
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070" />
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD" />
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1" />
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6" />
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B" />
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4" />
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5" />
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383" />

<Style x:Key="CollapseSideBarButtonStyleTrigger" TargetType="Button">
<Setter Property="Width" Value="10" />
<Setter Property="Background" Value="#2772db" />
Expand Down Expand Up @@ -68,13 +90,56 @@
</Style>

<Style TargetType="Button" x:Key="CopyToClipboardButtonStyle">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Margin" Value="0,0,10,0" />
<Setter Property="Width" Value="17" />
<Setter Property="Height" Value="17" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="ToolTip" Value="Copy to Clipboard" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border"
Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource CopyImage}" />
<Setter Property="BorderBrush" TargetName="border"
Value="{StaticResource Button.MouseOver.Border}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource CopyImage}" />
<Setter Property="Width" TargetName="border" Value="16" />
<Setter Property="Height" TargetName="border" Value="16" />
<Setter Property="BorderBrush" TargetName="border"
Value="{StaticResource Button.Pressed.Border}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource CopyImage}" />
<Setter Property="BorderBrush" TargetName="border"
Value="{StaticResource Button.Disabled.Border}" />
<Setter Property="TextElement.Foreground" TargetName="contentPresenter"
Value="{StaticResource Button.Disabled.Foreground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
11 changes: 2 additions & 9 deletions TrustCenterSearch.Presentation/Resources/Styles/IconStyles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5" />
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383" />

<Style x:Key="BinImageStyle" TargetType="{x:Type Button}">
<Style x:Key="DeleteTrustCenterImageStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
<Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />
Expand Down Expand Up @@ -64,8 +64,6 @@
Value="{StaticResource Button.MouseOver.Border}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border"
Value="{StaticResource Button.Pressed.Background}" />
<Setter Property="BorderBrush" TargetName="border"
Value="{StaticResource Button.Pressed.Border}" />
</Trigger>
Expand Down Expand Up @@ -118,10 +116,7 @@
Value="{StaticResource Button.MouseOver.Border}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border"
Value="{StaticResource Button.Pressed.Background}" />
<Setter Property="BorderBrush" TargetName="border"
Value="{StaticResource Button.Pressed.Border}" />
<Setter Property="Background" TargetName="border" Value="{StaticResource infoIcon}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border"
Expand Down Expand Up @@ -188,8 +183,6 @@
Value="{StaticResource Button.MouseOver.Border}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border"
Value="{StaticResource Button.Pressed.Background}" />
<Setter Property="BorderBrush" TargetName="border"
Value="{StaticResource Button.Pressed.Border}" />
</Trigger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
<Setter Property="Foreground" Value="Gray" />
<Setter Property="Margin" Value="0,0,5,0" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontSize" Value="10" />
<Setter Property="FontWeight" Value="Light"></Setter>
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>

Expand Down

0 comments on commit 7306774

Please sign in to comment.