1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Tango.Console">
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
<Style TargetType="{x:Type local:ConsoleTextBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="CaretBrush" Value="{x:Null}"></Setter>
<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="CaretBottomBrush" Value="White"></Setter>
<Setter Property="SuggestionsBorderBrush" Value="DimGray"></Setter>
<Setter Property="SuggestionsBackground" Value="#202020"></Setter>
<Setter Property="SuggestionsForeground" Value="Silver"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ConsoleTextBox}">
<Grid>
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
<Canvas>
<Border x:Name="PART_Caret" Visibility="Collapsed" IsHitTestVisible="False" Canvas.Left="0" Canvas.Bottom="0" Width="8" Height="4" Background="{TemplateBinding CaretBottomBrush}">
<Border.Triggers>
<EventTrigger RoutedEvent="Border.Loaded">
<BeginStoryboard>
<Storyboard x:Name="CaretStoryBoard" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="0:0:0:1" FillBehavior="HoldEnd">
<DoubleAnimationUsingKeyFrames.KeyFrames>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.500" Value="0" />
<DiscreteDoubleKeyFrame KeyTime="0:0:0.000" Value="1"/>
</DoubleAnimationUsingKeyFrames.KeyFrames>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Border.Triggers>
</Border>
<Popup x:Name="PART_SuggestionsPopup" MinWidth="200" MaxHeight="300" Placement="RelativePoint" StaysOpen="False" IsOpen="{TemplateBinding IsSuggestionsOpened}">
<Border BorderThickness="1" BorderBrush="{TemplateBinding SuggestionsBorderBrush}" Background="{TemplateBinding SuggestionsBackground}" MinWidth="200" MaxHeight="300">
<Grid>
<ListBox Foreground="{TemplateBinding SuggestionsForeground}" x:Name="PART_listSuggestions" FocusVisualStyle="{x:Null}" Background="Transparent" ItemsSource="{TemplateBinding FilteredSuggestions}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=local:ConsoleTextBox},Path=SelectedSuggestion,Mode=TwoWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Stretch="Uniform" Width="16" Height="16" VerticalAlignment="Center">
<Image.Style>
<Style TargetType="Image">
<Setter Property="Source" Value="pack://application:,,,/Tango.Console;component/Images/thunder.png"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Type}" Value="Folder">
<Setter Property="Source" Value="pack://application:,,,/Tango.Console;component/Images/folder.png"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="File">
<Setter Property="Source" Value="pack://application:,,,/Tango.Console;component/Images/file.png"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="11" Text="{Binding Name}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Canvas HorizontalAlignment="Right" VerticalAlignment="Top">
<Popup x:Name="PART_popup" IsOpen="False" Placement="Right" HorizontalOffset="10">
<Border Padding="5" CornerRadius="3" MaxWidth="500" BorderThickness="1" BorderBrush="{TemplateBinding SuggestionsBorderBrush}" Background="{TemplateBinding SuggestionsBackground}">
<TextBlock FontSize="11" Foreground="{TemplateBinding SuggestionsForeground}" TextWrapping="Wrap" Text="{Binding ElementName=PART_listSuggestions,Path=SelectedItem.Description}"></TextBlock>
</Border>
</Popup>
</Canvas>
</Grid>
</Border>
</Popup>
</Canvas>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.Focus.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
<Condition Property="IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
</MultiTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
|