Skip to content
Permalink
Browse files

Replace Search box in CodeExplorer and ARRD with component

This commit also fixes #4915 by virtue of changing how the text is set
  • Loading branch information...
Vogel612 committed Apr 22, 2019
1 parent 4999e44 commit 702f18c48b3f878f6ef579c468c71d3134be2bf5
@@ -12,6 +12,7 @@
<DisabledWarnings>$(DisabledWarnings);1591</DisabledWarnings>
<ApplicationIcon>Ducky.ico</ApplicationIcon>
<!-- Give a fixed version to not blow XAML generated code to smithereens -->
<!-- This also fixes "Input string was not in the correct format" error message when referring to the current assembly in an XAML-Namespace -->
<AssemblyVersion>2.4.1</AssemblyVersion>
</PropertyGroup>
<Import Project="..\RubberduckBaseProject.csproj" />
@@ -9,7 +9,7 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:controls="clr-namespace:Rubberduck.UI.Controls"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="380" d:DesignWidth="600"
d:DataContext="{d:DesignInstance local:AddRemoveReferencesViewModel}">
<UserControl.Resources>
@@ -26,7 +26,6 @@
<local:ReferenceStatusImageSourceConverter x:Key="StatusToIcon" />
<local:PriorityButtonVisibilityConverter x:Key="PriorityButtonVisibility" />
<local:PriorityButtonImageSourceConverter x:Key="PriorityButtonIcon" />
<converters:SearchImageSourceConverter x:Key="SearchToIcon" />
<converters:BooleanToNonDimmedBrushConverter x:Key="BooleanToNonDimmed" />
<converters:BoolToHiddenVisibilityConverter x:Key="ProjectVisibilityConverter" />

@@ -35,39 +34,6 @@
<Setter Property="Height" Value="24" />
<Setter Property="Padding" Value="10,0" />
</Style>
<Style x:Key="PlaceHolder" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid>
<TextBox Text="{Binding Path=Text,
RelativeSource={RelativeSource TemplatedParent},
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}"
x:Name="textSource"
Background="Transparent"
Panel.ZIndex="2"
VerticalContentAlignment="Center" />
<TextBox Text="{TemplateBinding Tag}" Background="{TemplateBinding Background}" Panel.ZIndex="1">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="Transparent"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Text, Source={x:Reference textSource}}" Value="">
<Setter Property="Foreground" Value="LightGray"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Margin" Value="0" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
@@ -204,32 +170,11 @@
BorderThickness="1"
Margin="0,5"
Padding="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<TextBox Name="SearchBox" Grid.Column="0">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource PlaceHolder}">
<Setter Property="Height" Value="20" />
<Setter Property="Width" Value="Auto" />
<Setter Property="Tag" Value="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_SearchPlaceholder}" />
<Setter Property="Text" Value="{Binding Search, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</TextBox.Style>
</TextBox>
<Button Name="SearchButton" Grid.Column="1" Command="{Binding ClearSearchCommand}"
BorderBrush="{x:Static SystemColors.ControlLightBrush}"
Background="Transparent"
Width="20" Height="20" Padding="0" Margin="0,1">
<Image VerticalAlignment="Center" HorizontalAlignment="Center"
Width="16" Height="16" Source="{Binding Search, Converter={StaticResource SearchToIcon}, UpdateSourceTrigger=PropertyChanged}" />
<i:Interaction.Behaviors>
<controls:FocusElementAfterClickBehavior FocusElement="{Binding ElementName=SearchBox, Mode=OneWay}"/>
</i:Interaction.Behaviors>
</Button>
</Grid>
<controls:SearchBox x:Name="SearchBox" Grid.Column="0"
Background="{x:Static SystemColors.WindowBrush}"
Width="Auto"
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Hint="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_SearchPlaceholder}" />
</Border>
<Border Grid.Row="1" Grid.Column="0">
<ListView Name="LibrarySelect" SelectedItem="{Binding SelectedLibrary, Mode=TwoWay}"
@@ -5,9 +5,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:codeExplorer="clr-namespace:Rubberduck.Navigation.CodeExplorer"
xmlns:controls="clr-namespace:Rubberduck.UI.Controls"
xmlns:converters="clr-namespace:Rubberduck.UI.Converters"
xmlns:local="clr-namespace:Rubberduck.UI.CodeExplorer"
xmlns:controls="clr-namespace:Rubberduck.UI.Controls;assembly="
xmlns:converters="clr-namespace:Rubberduck.UI.Converters;assembly="
xmlns:local="clr-namespace:Rubberduck.UI.CodeExplorer;assembly="
ResxExtension.DefaultResxName="Rubberduck.Resources.CodeExplorer.CodeExplorerUI"
Language="{UICulture}"
Name="CodeExplorer"
@@ -48,7 +48,6 @@
<converters:BoolToHiddenVisibilityConverter x:Key="BoolToHiddenVisibility" />
<converters:BooleanToDimmedBrushConverter x:Key="BooleanToDimmed" />
<converters:TemplateCommandParameterToTupleConverter x:Key="TemplateCommandParameterToTuple" />
<converters:SearchImageSourceConverter x:Key="SearchToIcon" />
<converters:InvertBoolValueConverter x:Key="NotBool" />
<converters:CodeExplorerNodeToIconConverter x:Key="NodeToIcon" />
<converters:AccessibilityToIconConverter x:Key="AccessibilityToIcon" />
@@ -64,37 +63,6 @@
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />

<Style x:Key="PlaceHolder" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid>
<TextBox Text="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
x:Name="textSource"
Background="Transparent"
Panel.ZIndex="2"
VerticalContentAlignment="Center"/>
<TextBox Text="{TemplateBinding Tag}" Background="{TemplateBinding Background}" Panel.ZIndex="1">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="Transparent"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Text, Source={x:Reference textSource}}" Value="">
<Setter Property="Foreground" Value="LightGray"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Margin" Value="0" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<CompositeCollection x:Key="AddModuleCommands">
<MenuItem Header="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_AddVBFormText}"
Command="{Binding AddVBFormCommand}"
@@ -419,32 +387,13 @@
BorderBrush="{x:Static SystemColors.ActiveBorderBrush}"
BorderThickness="1"
Padding="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<TextBox Name="SearchBox" Grid.Column="0">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource PlaceHolder}">
<Setter Property="Height" Value="20" />
<Setter Property="Width" Value="Auto" />
<Setter Property="Tag" Value="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_SearchPlaceholder}" />
<Setter Property="Text" Value="{Binding Search, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</TextBox.Style>
</TextBox>
<Button Name="SearchButton" Grid.Column="1" Command="{Binding ClearSearchCommand}"
BorderBrush="{x:Static SystemColors.ControlLightBrush}"
Background="Transparent"
Width="20" Height="20" Padding="0" Margin="0,1">
<Image VerticalAlignment="Center" HorizontalAlignment="Center"
Width="16" Height="16" Source="{Binding Search, Converter={StaticResource SearchToIcon}, UpdateSourceTrigger=PropertyChanged}" />
<i:Interaction.Behaviors>
<controls:FocusElementAfterClickBehavior FocusElement="{Binding ElementName=SearchBox, Mode=OneWay}"/>
</i:Interaction.Behaviors>
</Button>
</Grid>
<controls:SearchBox x:Name="SearchBox"
Background="{x:Static SystemColors.WindowBrush}"
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Hint="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI,
Key=CodeExplorer_SearchPlaceholder}"
Grid.Column="0"
Width="Auto"/>
</Border>

<TreeView x:Name="ProjectTree"
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Sunburst.NET.Sdk.WPF/1.0.47" ToolsVersion="15.0">
<Project Sdk="Sunburst.NET.Sdk.WPF/1.0.47">
<PropertyGroup>
<Title>Rubberduck.JunkDrawer</Title>
<Product>Rubberduck.JunkDrawer</Product>
<Copyright>Copyright © 2016-2018</Copyright>
<Copyright>Copyright © 2019</Copyright>
<ProjectGuid>{D7A3F7A3-BD90-4845-B098-AC3AFBF0E16F}</ProjectGuid>
<RootNamespace>Rubberduck.JunkDrawer</RootNamespace>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
<Import Project="..\RubberduckBaseProject.csproj" />
</Project>
@@ -3,7 +3,7 @@
<PropertyGroup>
<Title>Rubberduck.Resources</Title>
<Product>Rubberduck.Resources</Product>
<Copyright>Copyright © 2018</Copyright>
<Copyright>Copyright © 2018-2019</Copyright>
<ProjectGuid>{1B84B387-F7C4-4876-9BDF-C644C365359A}</ProjectGuid>
</PropertyGroup>
<Import Project="..\RubberduckBaseProject.csproj" />

0 comments on commit 702f18c

Please sign in to comment.
You can’t perform that action at this time.