Skip to content

Commit 702f18c

Browse files
committed
Replace Search box in CodeExplorer and ARRD with component
This commit also fixes #4915 by virtue of changing how the text is set
1 parent 4999e44 commit 702f18c

File tree

5 files changed

+21
-125
lines changed

5 files changed

+21
-125
lines changed

Rubberduck.Core/Rubberduck.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<DisabledWarnings>$(DisabledWarnings);1591</DisabledWarnings>
1313
<ApplicationIcon>Ducky.ico</ApplicationIcon>
1414
<!-- Give a fixed version to not blow XAML generated code to smithereens -->
15+
<!-- This also fixes "Input string was not in the correct format" error message when referring to the current assembly in an XAML-Namespace -->
1516
<AssemblyVersion>2.4.1</AssemblyVersion>
1617
</PropertyGroup>
1718
<Import Project="..\RubberduckBaseProject.csproj" />

Rubberduck.Core/UI/AddRemoveReferences/AddRemoveReferencesWindow.xaml

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
1010
xmlns:controls="clr-namespace:Rubberduck.UI.Controls"
1111
xmlns:system="clr-namespace:System;assembly=mscorlib"
12-
mc:Ignorable="d"
12+
mc:Ignorable="d"
1313
d:DesignHeight="380" d:DesignWidth="600"
1414
d:DataContext="{d:DesignInstance local:AddRemoveReferencesViewModel}">
1515
<UserControl.Resources>
@@ -26,7 +26,6 @@
2626
<local:ReferenceStatusImageSourceConverter x:Key="StatusToIcon" />
2727
<local:PriorityButtonVisibilityConverter x:Key="PriorityButtonVisibility" />
2828
<local:PriorityButtonImageSourceConverter x:Key="PriorityButtonIcon" />
29-
<converters:SearchImageSourceConverter x:Key="SearchToIcon" />
3029
<converters:BooleanToNonDimmedBrushConverter x:Key="BooleanToNonDimmed" />
3130
<converters:BoolToHiddenVisibilityConverter x:Key="ProjectVisibilityConverter" />
3231

@@ -35,39 +34,6 @@
3534
<Setter Property="Height" Value="24" />
3635
<Setter Property="Padding" Value="10,0" />
3736
</Style>
38-
<Style x:Key="PlaceHolder" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
39-
<Setter Property="Template">
40-
<Setter.Value>
41-
<ControlTemplate TargetType="{x:Type TextBox}">
42-
<Grid>
43-
<TextBox Text="{Binding Path=Text,
44-
RelativeSource={RelativeSource TemplatedParent},
45-
Mode=TwoWay,
46-
UpdateSourceTrigger=PropertyChanged}"
47-
x:Name="textSource"
48-
Background="Transparent"
49-
Panel.ZIndex="2"
50-
VerticalContentAlignment="Center" />
51-
<TextBox Text="{TemplateBinding Tag}" Background="{TemplateBinding Background}" Panel.ZIndex="1">
52-
<TextBox.Style>
53-
<Style TargetType="{x:Type TextBox}">
54-
<Setter Property="Foreground" Value="Transparent"/>
55-
<Setter Property="VerticalContentAlignment" Value="Center"/>
56-
<Style.Triggers>
57-
<DataTrigger Binding="{Binding Path=Text, Source={x:Reference textSource}}" Value="">
58-
<Setter Property="Foreground" Value="LightGray"/>
59-
</DataTrigger>
60-
</Style.Triggers>
61-
</Style>
62-
</TextBox.Style>
63-
</TextBox>
64-
</Grid>
65-
</ControlTemplate>
66-
</Setter.Value>
67-
</Setter>
68-
<Setter Property="Margin" Value="0" />
69-
<Setter Property="VerticalAlignment" Value="Center" />
70-
</Style>
7137
<Style TargetType="{x:Type TabItem}">
7238
<Setter Property="Background" Value="Transparent" />
7339
<Setter Property="Template">
@@ -204,32 +170,11 @@
204170
BorderThickness="1"
205171
Margin="0,5"
206172
Padding="2">
207-
<Grid>
208-
<Grid.ColumnDefinitions>
209-
<ColumnDefinition Width="*" />
210-
<ColumnDefinition Width="20" />
211-
</Grid.ColumnDefinitions>
212-
<TextBox Name="SearchBox" Grid.Column="0">
213-
<TextBox.Style>
214-
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource PlaceHolder}">
215-
<Setter Property="Height" Value="20" />
216-
<Setter Property="Width" Value="Auto" />
217-
<Setter Property="Tag" Value="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_SearchPlaceholder}" />
218-
<Setter Property="Text" Value="{Binding Search, UpdateSourceTrigger=PropertyChanged}" />
219-
</Style>
220-
</TextBox.Style>
221-
</TextBox>
222-
<Button Name="SearchButton" Grid.Column="1" Command="{Binding ClearSearchCommand}"
223-
BorderBrush="{x:Static SystemColors.ControlLightBrush}"
224-
Background="Transparent"
225-
Width="20" Height="20" Padding="0" Margin="0,1">
226-
<Image VerticalAlignment="Center" HorizontalAlignment="Center"
227-
Width="16" Height="16" Source="{Binding Search, Converter={StaticResource SearchToIcon}, UpdateSourceTrigger=PropertyChanged}" />
228-
<i:Interaction.Behaviors>
229-
<controls:FocusElementAfterClickBehavior FocusElement="{Binding ElementName=SearchBox, Mode=OneWay}"/>
230-
</i:Interaction.Behaviors>
231-
</Button>
232-
</Grid>
173+
<controls:SearchBox x:Name="SearchBox" Grid.Column="0"
174+
Background="{x:Static SystemColors.WindowBrush}"
175+
Width="Auto"
176+
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
177+
Hint="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_SearchPlaceholder}" />
233178
</Border>
234179
<Border Grid.Row="1" Grid.Column="0">
235180
<ListView Name="LibrarySelect" SelectedItem="{Binding SelectedLibrary, Mode=TwoWay}"

Rubberduck.Core/UI/CodeExplorer/CodeExplorerControl.xaml

Lines changed: 10 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
77
xmlns:codeExplorer="clr-namespace:Rubberduck.Navigation.CodeExplorer"
8-
xmlns:controls="clr-namespace:Rubberduck.UI.Controls"
9-
xmlns:converters="clr-namespace:Rubberduck.UI.Converters"
10-
xmlns:local="clr-namespace:Rubberduck.UI.CodeExplorer"
8+
xmlns:controls="clr-namespace:Rubberduck.UI.Controls;assembly="
9+
xmlns:converters="clr-namespace:Rubberduck.UI.Converters;assembly="
10+
xmlns:local="clr-namespace:Rubberduck.UI.CodeExplorer;assembly="
1111
ResxExtension.DefaultResxName="Rubberduck.Resources.CodeExplorer.CodeExplorerUI"
1212
Language="{UICulture}"
1313
Name="CodeExplorer"
@@ -48,7 +48,6 @@
4848
<converters:BoolToHiddenVisibilityConverter x:Key="BoolToHiddenVisibility" />
4949
<converters:BooleanToDimmedBrushConverter x:Key="BooleanToDimmed" />
5050
<converters:TemplateCommandParameterToTupleConverter x:Key="TemplateCommandParameterToTuple" />
51-
<converters:SearchImageSourceConverter x:Key="SearchToIcon" />
5251
<converters:InvertBoolValueConverter x:Key="NotBool" />
5352
<converters:CodeExplorerNodeToIconConverter x:Key="NodeToIcon" />
5453
<converters:AccessibilityToIconConverter x:Key="AccessibilityToIcon" />
@@ -64,37 +63,6 @@
6463
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
6564
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
6665

67-
<Style x:Key="PlaceHolder" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
68-
<Setter Property="Template">
69-
<Setter.Value>
70-
<ControlTemplate TargetType="{x:Type TextBox}">
71-
<Grid>
72-
<TextBox Text="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
73-
x:Name="textSource"
74-
Background="Transparent"
75-
Panel.ZIndex="2"
76-
VerticalContentAlignment="Center"/>
77-
<TextBox Text="{TemplateBinding Tag}" Background="{TemplateBinding Background}" Panel.ZIndex="1">
78-
<TextBox.Style>
79-
<Style TargetType="{x:Type TextBox}">
80-
<Setter Property="Foreground" Value="Transparent"/>
81-
<Setter Property="VerticalContentAlignment" Value="Center"/>
82-
<Style.Triggers>
83-
<DataTrigger Binding="{Binding Path=Text, Source={x:Reference textSource}}" Value="">
84-
<Setter Property="Foreground" Value="LightGray"/>
85-
</DataTrigger>
86-
</Style.Triggers>
87-
</Style>
88-
</TextBox.Style>
89-
</TextBox>
90-
</Grid>
91-
</ControlTemplate>
92-
</Setter.Value>
93-
</Setter>
94-
<Setter Property="Margin" Value="0" />
95-
<Setter Property="VerticalAlignment" Value="Center" />
96-
</Style>
97-
9866
<CompositeCollection x:Key="AddModuleCommands">
9967
<MenuItem Header="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_AddVBFormText}"
10068
Command="{Binding AddVBFormCommand}"
@@ -419,32 +387,13 @@
419387
BorderBrush="{x:Static SystemColors.ActiveBorderBrush}"
420388
BorderThickness="1"
421389
Padding="2">
422-
<Grid>
423-
<Grid.ColumnDefinitions>
424-
<ColumnDefinition Width="*" />
425-
<ColumnDefinition Width="20" />
426-
</Grid.ColumnDefinitions>
427-
<TextBox Name="SearchBox" Grid.Column="0">
428-
<TextBox.Style>
429-
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource PlaceHolder}">
430-
<Setter Property="Height" Value="20" />
431-
<Setter Property="Width" Value="Auto" />
432-
<Setter Property="Tag" Value="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_SearchPlaceholder}" />
433-
<Setter Property="Text" Value="{Binding Search, UpdateSourceTrigger=PropertyChanged}" />
434-
</Style>
435-
</TextBox.Style>
436-
</TextBox>
437-
<Button Name="SearchButton" Grid.Column="1" Command="{Binding ClearSearchCommand}"
438-
BorderBrush="{x:Static SystemColors.ControlLightBrush}"
439-
Background="Transparent"
440-
Width="20" Height="20" Padding="0" Margin="0,1">
441-
<Image VerticalAlignment="Center" HorizontalAlignment="Center"
442-
Width="16" Height="16" Source="{Binding Search, Converter={StaticResource SearchToIcon}, UpdateSourceTrigger=PropertyChanged}" />
443-
<i:Interaction.Behaviors>
444-
<controls:FocusElementAfterClickBehavior FocusElement="{Binding ElementName=SearchBox, Mode=OneWay}"/>
445-
</i:Interaction.Behaviors>
446-
</Button>
447-
</Grid>
390+
<controls:SearchBox x:Name="SearchBox"
391+
Background="{x:Static SystemColors.WindowBrush}"
392+
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
393+
Hint="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI,
394+
Key=CodeExplorer_SearchPlaceholder}"
395+
Grid.Column="0"
396+
Width="Auto"/>
448397
</Border>
449398

450399
<TreeView x:Name="ProjectTree"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project Sdk="Sunburst.NET.Sdk.WPF/1.0.47" ToolsVersion="15.0">
2+
<Project Sdk="Sunburst.NET.Sdk.WPF/1.0.47">
33
<PropertyGroup>
44
<Title>Rubberduck.JunkDrawer</Title>
55
<Product>Rubberduck.JunkDrawer</Product>
6-
<Copyright>Copyright © 2016-2018</Copyright>
6+
<Copyright>Copyright © 2019</Copyright>
77
<ProjectGuid>{D7A3F7A3-BD90-4845-B098-AC3AFBF0E16F}</ProjectGuid>
88
<RootNamespace>Rubberduck.JunkDrawer</RootNamespace>
9+
<TargetFramework>net46</TargetFramework>
910
</PropertyGroup>
1011
<Import Project="..\RubberduckBaseProject.csproj" />
1112
</Project>

Rubberduck.Resources/Rubberduck.Resources.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Title>Rubberduck.Resources</Title>
55
<Product>Rubberduck.Resources</Product>
6-
<Copyright>Copyright © 2018</Copyright>
6+
<Copyright>Copyright © 2018-2019</Copyright>
77
<ProjectGuid>{1B84B387-F7C4-4876-9BDF-C644C365359A}</ProjectGuid>
88
</PropertyGroup>
99
<Import Project="..\RubberduckBaseProject.csproj" />

0 commit comments

Comments
 (0)