aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml
blob: 4e12f40fc03ed52c7be685a41cbd38fa867deeb4 (plain)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Tango.AutoComplete.Editors">

    <BooleanToVisibilityConverter x:Key="BoolToVisConverter" />

    <Style TargetType="ListBoxItem"
           x:Key="SuggestionItemStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="ContentBorder"
                            Background="{Binding Path=SuggestionBackground, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:AutoCompleteTextBox}, Mode=OneWay}">
                        <ContentPresenter />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="ContentBorder"
                                    Value="{x:Static SystemColors.HighlightBrush}" />
                            <Setter Property="IsSelected"
                                    Value="True" />
                        </Trigger>
                        <Trigger Property="IsSelected"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="ContentBorder"
                                    Value="{x:Static SystemColors.HighlightBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TextBox}"
           x:Key="TransparentTextBoxStyle">
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid>
                        <ScrollViewer x:Name="PART_ContentHost"
                                      Background="Transparent"
                                      Focusable="True"
                                      HorizontalScrollBarVisibility="Hidden"
                                      VerticalScrollBarVisibility="Hidden" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:AutoCompleteTextBox}">
        <Setter Property="Focusable"
                Value="False" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="BorderBrush"
                Value="Gray" />
        <Setter Property="Validation.ErrorTemplate" 
                Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:AutoCompleteTextBox}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            CornerRadius="3">
                        <Grid>
                            <DockPanel>
                                <ContentPresenter ContentSource="Icon"
                                                  x:Name="PART_Icon"
                                                  Visibility="{TemplateBinding IconVisibility}" />
                                <Grid>
                                    <TextBlock x:Name="PART_Watermark"
                                               Text="{TemplateBinding Watermark}"
                                               Visibility="Collapsed"
                                               VerticalAlignment="Center"
                                               HorizontalAlignment="Left"
                                               Focusable="False"
                                               Foreground="Gray"
                                               Margin="3,0" />
                                    <TextBox x:Name="PART_Editor"
                                             HorizontalAlignment="Stretch"
                                             VerticalAlignment="Center"
											 Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay}"
                                             Style="{StaticResource ResourceKey=TransparentTextBoxStyle}"
                                             Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" />
                                </Grid>
                            </DockPanel>
                            <Popup x:Name="PART_Popup"
                                   IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
                                   MinWidth="{TemplateBinding ActualWidth}"
                                   MaxWidth="800"
                                   HorizontalOffset="0"
                                   MinHeight="25"
                                   MaxHeight="600"
                                   AllowsTransparency="True"
                                   PopupAnimation="Slide"
                                   Focusable="False">
                                <Border Background="White"
                                        BorderThickness="1"
                                        BorderBrush="Gray"
                                        CornerRadius="5"
                                        Padding="2">
                                    <Grid>
                                        <ListBox x:Name="PART_Selector"
                                                 ItemTemplate="{TemplateBinding ItemTemplate}"
                                                 ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                                 DisplayMemberPath="{TemplateBinding DisplayMember}"
                                                 Focusable="False"
                                                 BorderThickness="0"
                                                 MaxHeight="{Binding Path=MaxPopupHeight, RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
                                                 ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                                 ScrollViewer.VerticalScrollBarVisibility="Auto"
                                                 ItemContainerStyle="{StaticResource ResourceKey=SuggestionItemStyle}">
                                        </ListBox>
                                        <Border Visibility="{Binding Path=IsLoading, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource ResourceKey=BoolToVisConverter}}">
                                            <ContentPresenter ContentSource="LoadingContent"/>
                                        </Border>
                                    </Grid>
                                </Border>
                            </Popup>

                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Text"
                                 Value=""
                                 SourceName="PART_Editor">
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="PART_Watermark" />
                        </Trigger>
                        <Trigger Property="IconPlacement"
                                 Value="Left">
                            <Setter Property="DockPanel.Dock"
                                    Value="Left"
                                    TargetName="PART_Icon" />
                        </Trigger>
                        <Trigger Property="IconPlacement"
                                 Value="Right">
                            <Setter Property="DockPanel.Dock"
                                    Value="Right"
                                    TargetName="PART_Icon" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="BorderBrush"
                                    Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>