Skip to content

Commit ca4d888

Browse files
committed
updated UI, reworded some resource strings, broke treeview styling.
1 parent 45c199e commit ca4d888

File tree

11 files changed

+253
-144
lines changed

11 files changed

+253
-144
lines changed

RetailCoder.VBE/UI/Command/MenuItems/RegexAssistantCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using NLog;
1+
using System.Runtime.InteropServices;
2+
using NLog;
23
using Rubberduck.UI.RegexAssistant;
3-
using System.Runtime.InteropServices;
44

5-
namespace Rubberduck.UI.Command
5+
namespace Rubberduck.UI.Command.MenuItems
66
{
77
/// <summary>
88
/// A command that displays the RegexAssistantDialog

RetailCoder.VBE/UI/RegexAssistant/RegexAssistant.xaml

Lines changed: 77 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -4,115 +4,94 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:assistant="clr-namespace:Rubberduck.UI.RegexAssistant"
7-
mc:Ignorable="d"
8-
d:DesignHeight="300" Width="555"
9-
d:DataContext="{d:DesignInstance {x:Type assistant:RegexAssistantViewModel}, IsDesignTimeCreatable=False}">
7+
mc:Ignorable="d" Width="555"
8+
d:DataContext="{d:DesignInstance {x:Type assistant:RegexAssistantViewModel}, IsDesignTimeCreatable=False}" Height="302">
9+
1010
<UserControl.Resources>
11-
<!-- Style adapted from http://stackoverflow.com/a/16640367/1803692 -->
12-
<Style TargetType="{x:Type TreeViewItem}" x:Key="ShinyRegexTreeViewItem">
13-
<Setter Property="Template">
14-
<Setter.Value>
15-
<ControlTemplate TargetType="{x:Type TreeViewItem}">
16-
<Grid>
17-
<Grid.ColumnDefinitions>
18-
<ColumnDefinition MinWidth="19" Width="Auto"/>
19-
<ColumnDefinition Width="Auto"/>
20-
</Grid.ColumnDefinitions>
21-
<Grid.RowDefinitions>
22-
<RowDefinition Height="Auto"/>
23-
<RowDefinition Height="Auto"/>
24-
</Grid.RowDefinitions>
11+
12+
<LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" EndPoint="0,1" StartPoint="0,0">
13+
<GradientStop Color="#FFD9F4FF" Offset="0"/>
14+
<GradientStop Color="#FF9BDDFB" Offset="1"/>
15+
</LinearGradientBrush>
16+
17+
<LinearGradientBrush x:Key="{x:Static SystemColors.ControlBrushKey}" EndPoint="0,1" StartPoint="0,0">
18+
<GradientStop Color="#FFEEEDED" Offset="0"/>
19+
<GradientStop Color="#FFDDDDDD" Offset="1"/>
20+
</LinearGradientBrush>
21+
22+
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
23+
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
2524

26-
<ToggleButton x:Name="Expander"
27-
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
28-
ClickMode="Press"/>
29-
<Border Name="Bd"
30-
Grid.Column="1"
31-
Background="{TemplateBinding Background}"
32-
BorderBrush="{TemplateBinding BorderBrush}"
33-
BorderThickness="{TemplateBinding BorderThickness}"
34-
Padding="{TemplateBinding Padding}"
35-
SnapsToDevicePixels="True">
36-
<ContentPresenter x:Name="PART_Header"
37-
ContentSource="Header"
38-
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
39-
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
40-
</Border>
41-
<Border x:Name="ItemsHostBd" Grid.Row="1" Grid.Column="1">
42-
<ItemsPresenter x:Name="ItemsHost" />
43-
</Border>
44-
</Grid>
45-
<ControlTemplate.Triggers>
46-
<Trigger Property="IsExpanded" Value="False">
47-
<Setter TargetName="ItemsHostBd" Property="Visibility" Value="Collapsed"/>
48-
</Trigger>
49-
<Trigger Property="HasItems" Value="False">
50-
<Setter TargetName="Expander" Property="Visibility" Value="Hidden"/>
51-
</Trigger>
52-
<Trigger Property="IsSelected" Value="True">
53-
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
54-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
55-
</Trigger>
56-
<MultiTrigger>
57-
<MultiTrigger.Conditions>
58-
<Condition Property="IsSelected" Value="True"/>
59-
<Condition Property="IsSelectionActive" Value="False"/>
60-
</MultiTrigger.Conditions>
61-
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
62-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
63-
</MultiTrigger>
64-
<Trigger Property="IsEnabled" Value="False">
65-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
66-
</Trigger>
67-
</ControlTemplate.Triggers>
68-
</ControlTemplate>
69-
</Setter.Value>
70-
</Setter>
25+
<Style x:Key="ShinyTreeView" TargetType="{x:Type TreeViewItem}">
26+
<Setter Property="BorderThickness" Value="1.5"/>
27+
<Setter Property="HorizontalAlignment" Value="Left" />
28+
<Style.Triggers>
29+
<Trigger Property="IsSelected" Value="True">
30+
<Setter Property="BorderBrush" Value="#adc6e5"/>
31+
</Trigger>
32+
<MultiTrigger>
33+
<MultiTrigger.Conditions>
34+
<Condition Property="IsSelected" Value="True"/>
35+
<Condition Property="IsSelectionActive" Value="False"/>
36+
</MultiTrigger.Conditions>
37+
<Setter Property="BorderBrush" Value="LightGray"/>
38+
</MultiTrigger>
39+
</Style.Triggers>
40+
<Style.Resources>
41+
<Style TargetType="Border">
42+
<Setter Property="CornerRadius" Value="2"/>
43+
</Style>
44+
</Style.Resources>
7145
</Style>
7246

7347
<HierarchicalDataTemplate
7448
x:Key="RecursiveData" DataType="TreeViewItem"
75-
ItemContainerStyle="{StaticResource ShinyRegexTreeViewItem}"
49+
ItemContainerStyle="{StaticResource ShinyTreeView}"
7650
ItemsSource="{Binding Items}">
7751
</HierarchicalDataTemplate>
52+
7853
</UserControl.Resources>
79-
<Grid Margin="0,0,0,0">
54+
55+
<Grid>
8056
<ScrollViewer VerticalContentAlignment="Stretch">
81-
<StackPanel Margin="5,5,5,5">
82-
<Label DockPanel.Dock="Top" Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_Caption}"
83-
Background="DarkGray"
84-
Foreground="White"
85-
FontWeight="SemiBold"
86-
Margin="0,0,0,3">
87-
<Label.Style>
88-
<Style>
89-
<Style.Resources>
90-
<Style TargetType="{x:Type Border}">
91-
<Setter Property="CornerRadius" Value="5"/>
92-
</Style>
93-
</Style.Resources>
94-
</Style>
95-
</Label.Style>
96-
</Label>
97-
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_RegexPatternLabel}"
98-
FontWeight="SemiBold" />
99-
<TextBox HorizontalAlignment="Left" TextWrapping="Wrap"
100-
VerticalAlignment="Top" MinWidth="250" MinHeight="23" MaxHeight="23"
101-
VerticalContentAlignment="Center" Margin="15,5,5,5" Text="{Binding Pattern}"/>
102-
<StackPanel Orientation="Horizontal">
103-
<CheckBox Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_GlobalFlag}"
104-
HorizontalAlignment="Left" Height="18" VerticalAlignment="Top" MinWidth="110"
105-
Margin="15,5,5,5" IsChecked="{Binding GlobalFlag}"/>
106-
<CheckBox Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_IgnoreCaseFlag}"
107-
HorizontalAlignment="Left" Height="18" VerticalAlignment="Top" MinWidth="110"
108-
Margin="15,5,5,5" IsChecked="{Binding IgnoreCaseFlag}"/>
109-
</StackPanel>
110-
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_DescriptionResultsLabel}"
111-
FontWeight="SemiBold" />
57+
<StackPanel Margin="5">
58+
59+
<GroupBox>
60+
<GroupBox.Header>
61+
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_RegexPatternLabel}"
62+
FontWeight="SemiBold" />
63+
</GroupBox.Header>
64+
65+
<StackPanel>
66+
<TextBox HorizontalAlignment="Stretch"
67+
VerticalAlignment="Top" Height="23"
68+
VerticalContentAlignment="Center" Margin="5"
69+
Text="{Binding Pattern}"/>
70+
71+
<StackPanel Orientation="Horizontal" Margin="5,0,5,0">
72+
<CheckBox Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_GlobalFlag}"
73+
IsChecked="{Binding GlobalFlag}"
74+
Margin="0,0,5,0"/>
75+
<CheckBox Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_IgnoreCaseFlag}"
76+
IsChecked="{Binding IgnoreCaseFlag}"
77+
Margin="0,0,5,0"/>
78+
</StackPanel>
79+
</StackPanel>
80+
81+
</GroupBox>
82+
83+
<GroupBox Margin="5" MinHeight="200">
84+
<GroupBox.Header>
85+
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=RegexAssistant_DescriptionResultsLabel}" FontWeight="SemiBold" />
86+
</GroupBox.Header>
11287

113-
<TreeView x:Name="treeView" ItemTemplate="{StaticResource RecursiveData}" ItemContainerStyle="{StaticResource ShinyRegexTreeViewItem}"
114-
VerticalAlignment="Stretch" Margin="15,10,10,10" HorizontalContentAlignment="Stretch" Height="Auto"
115-
ItemsSource="{Binding ResultItems}" DockPanel.Dock="Bottom" />
88+
<TreeView ItemTemplate="{StaticResource RecursiveData}"
89+
ItemContainerStyle="{StaticResource ShinyTreeView}"
90+
Margin="5"
91+
VerticalAlignment="Stretch"
92+
HorizontalContentAlignment="Stretch"
93+
ItemsSource="{Binding ResultItems}" />
94+
</GroupBox>
11695
</StackPanel>
11796
</ScrollViewer>
11897
</Grid>

RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.Designer.cs

Lines changed: 84 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,10 @@ public RegexAssistantDialog()
2727
RegexAssistant.DataContext = _viewModel;
2828
}
2929
}
30+
31+
private void CloseButton_Click(object sender, EventArgs e)
32+
{
33+
Close();
34+
}
3035
}
3136
}

0 commit comments

Comments
 (0)