Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from paulcbetts/haacked/add-filtering
Add ability to filter keys
- Loading branch information
Showing
7 changed files
with
122 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.ComponentModel; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace AkavacheExplorer.Controls | ||
{ | ||
public class PromptTextBox : TextBox | ||
{ | ||
public static readonly DependencyProperty PromptTextProperty = | ||
DependencyProperty.Register("PromptText", typeof(string), typeof(PromptTextBox), new UIPropertyMetadata("")); | ||
|
||
[Localizability(LocalizationCategory.Text)] | ||
[DefaultValue("")] | ||
public string PromptText | ||
{ | ||
get { return (string)GetValue(PromptTextProperty); } | ||
set { SetValue(PromptTextProperty, value); } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:ui="clr-namespace:AkavacheExplorer.Controls"> | ||
<SolidColorBrush x:Key="TextBoxMouseOverBorderBrush" Color="#FFA9A9A9" /> | ||
<!-- The blue accent color used through-out the app --> | ||
<Color x:Key="AccentColor">#4ea6ea</Color> | ||
<SolidColorBrush x:Key="AccentBrush" Color="{StaticResource AccentColor}" /> | ||
|
||
<Style TargetType="{x:Type ui:PromptTextBox}"> | ||
<Setter Property="Background" Value="White"/> | ||
<Setter Property="BorderBrush" Value="#D1D1D1"/> | ||
<Setter Property="Foreground" Value="#333333"/> | ||
<Setter Property="BorderThickness" Value="1"/> | ||
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/> | ||
<Setter Property="HorizontalContentAlignment" Value="Left"/> | ||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> | ||
<Setter Property="AllowDrop" Value="true"/> | ||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> | ||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> | ||
<Setter Property="Height" Value="24" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type ui:PromptTextBox}"> | ||
<Grid> | ||
<Border x:Name="Bd" CornerRadius="2" ClipToBounds="True" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"> | ||
<Border CornerRadius="0" BorderBrush="Black" BorderThickness="0,1,0,0" Margin="2,-2,2,0" Opacity="0.4"> | ||
<Border.Effect> | ||
<DropShadowEffect Direction="270" ShadowDepth="0" BlurRadius="4" Opacity="1" /> | ||
</Border.Effect> | ||
</Border> | ||
</Border> | ||
|
||
<Grid Margin="1,0,0,0"> | ||
<ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" VerticalAlignment="Top" Margin="0"/> | ||
<Label x:Name="PromptLabel" HorizontalAlignment="Left" | ||
FontSize="{TemplateBinding FontSize}" Margin="2,0,0,0" Padding="{TemplateBinding Padding}" Opacity="0" | ||
Target="{Binding ElementName=Bd}" | ||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Focusable="False" IsHitTestVisible="False" | ||
VerticalAlignment="Top"> | ||
<TextBlock Text="{TemplateBinding PromptText}" TextTrimming="CharacterEllipsis" /> | ||
</Label> | ||
</Grid> | ||
</Grid> | ||
|
||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsEnabled" Value="False"> | ||
<Setter Property="Background" TargetName="Bd" | ||
Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> | ||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | ||
</Trigger> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource TextBoxMouseOverBorderBrush}" /> | ||
</Trigger> | ||
<Trigger Property="IsKeyboardFocusWithin" Value="True"> | ||
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource GitHubAccentBrush}" /> | ||
</Trigger> | ||
<DataTrigger Binding="{Binding Text.Length, RelativeSource={RelativeSource Self}}" Value="0"> | ||
<Setter Property="Opacity" TargetName="PromptLabel" Value="0.7" /> | ||
<Setter Property="Foreground" Value="Transparent" /> | ||
</DataTrigger> | ||
</ControlTemplate.Triggers> | ||
|
||
</ControlTemplate> | ||
|
||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters