Mercurial > silverbladetech
comparison MetroWpf/MetroWpf.Xaml/Styles/Controls.WatermarkTextBox.xaml @ 18:8049f7c58c2b
Login form 75% there
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Wed, 14 Mar 2012 18:06:36 +0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17:7721a1270363 | 18:8049f7c58c2b |
---|---|
1 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
2 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
3 xmlns:local="clr-namespace:Microsoft.Windows.Controls" | |
4 xmlns:System="clr-namespace:System;assembly=mscorlib"> | |
5 | |
6 <LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0"> | |
7 <GradientStop Color="#ABADB3" Offset="0.05"/> | |
8 <GradientStop Color="#E2E3EA" Offset="0.07"/> | |
9 <GradientStop Color="#E3E9EF" Offset="1"/> | |
10 </LinearGradientBrush> | |
11 | |
12 <LinearGradientBrush x:Key="TextBox_MouseOver" EndPoint="0,1" StartPoint="0,0"> | |
13 <GradientStop Color="#5794BF" Offset="0.05"/> | |
14 <GradientStop Color="#B7D5EA" Offset="0.07"/> | |
15 <GradientStop Color="#C7E2F1" Offset="1"/> | |
16 </LinearGradientBrush> | |
17 | |
18 <LinearGradientBrush x:Key="TextBox_Focused" EndPoint="0,1" StartPoint="0,0"> | |
19 <GradientStop Color="#3D7BAD" Offset="0.05"/> | |
20 <GradientStop Color="#A4C9E3" Offset="0.07"/> | |
21 <GradientStop Color="#B7D9ED" Offset="1"/> | |
22 </LinearGradientBrush> | |
23 | |
24 <SolidColorBrush x:Key="TextBox_DisabledBorder" Color="#ADB2B5" /> | |
25 <SolidColorBrush x:Key="TextBox_DisabledBackground" Color="#F4F4F4" /> | |
26 | |
27 <DataTemplate x:Key="DefaultWatermarkTemplate"> | |
28 <ContentControl Content="{Binding}" Foreground="Gray" Focusable="False" /> | |
29 </DataTemplate> | |
30 | |
31 <Style TargetType="{x:Type local:WatermarkTextBox}"> | |
32 <Setter Property="FontFamily" Value="{DynamicResource ContentFontFamily}" /> | |
33 <Setter Property="FontSize" Value="{DynamicResource ContentFontSize}" /> | |
34 <Setter Property="BorderThickness" Value="1" /> | |
35 <Setter Property="Height" Value="26" /> | |
36 <Setter Property="MinHeight" Value="26" /> | |
37 <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}" /> | |
38 <Setter Property="Foreground" Value="{DynamicResource TextBrush}" /> | |
39 <Setter Property="VerticalContentAlignment" Value="Center" /> | |
40 <Setter Property="Padding" Value="0" /> | |
41 <Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}" /> | |
42 <Setter Property="AllowDrop" Value="true"/> | |
43 <Setter Property="FocusVisualStyle" Value="{x:Null}"/> | |
44 <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> | |
45 <Setter Property="Stylus.IsFlicksEnabled" Value="False"/> | |
46 <Setter Property="WatermarkTemplate" Value="{StaticResource DefaultWatermarkTemplate}" /> | |
47 <Setter Property="Template"> | |
48 <Setter.Value> | |
49 <ControlTemplate TargetType="{x:Type local:WatermarkTextBox}"> | |
50 <Grid> | |
51 <VisualStateManager.VisualStateGroups> | |
52 <VisualStateGroup x:Name="CommonStates"> | |
53 <VisualState x:Name="Normal" /> | |
54 <VisualState x:Name="MouseOver"> | |
55 <Storyboard> | |
56 <DoubleAnimation Duration="0" | |
57 To="1" | |
58 Storyboard.TargetProperty="(UIElement.Opacity)" | |
59 Storyboard.TargetName="FocusRectangle" /> | |
60 </Storyboard> | |
61 </VisualState> | |
62 <VisualState x:Name="Disabled"> | |
63 <Storyboard> | |
64 <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" | |
65 Storyboard.TargetName="DisabledVisualElement"> | |
66 <SplineDoubleKeyFrame KeyTime="0" | |
67 Value="1" /> | |
68 </DoubleAnimationUsingKeyFrames> | |
69 </Storyboard> | |
70 </VisualState> | |
71 <VisualState x:Name="ReadOnly"> | |
72 <Storyboard> | |
73 <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" | |
74 Storyboard.TargetName="ReadOnlyVisualElement"> | |
75 <SplineDoubleKeyFrame KeyTime="0" | |
76 Value="1" /> | |
77 </DoubleAnimationUsingKeyFrames> | |
78 </Storyboard> | |
79 </VisualState> | |
80 </VisualStateGroup> | |
81 <VisualStateGroup x:Name="FocusStates"> | |
82 <VisualState x:Name="Focused"> | |
83 <Storyboard> | |
84 <DoubleAnimation Duration="0" | |
85 To="1" | |
86 Storyboard.TargetProperty="(UIElement.Opacity)" | |
87 Storyboard.TargetName="FocusRectangle" /> | |
88 <DoubleAnimation Duration="0" | |
89 To="1" | |
90 Storyboard.TargetProperty="(UIElement.Opacity)" | |
91 Storyboard.TargetName="FocusInnerRectangle" /> | |
92 </Storyboard> | |
93 </VisualState> | |
94 <VisualState x:Name="Unfocused"> | |
95 <Storyboard /> | |
96 </VisualState> | |
97 </VisualStateGroup> | |
98 <VisualStateGroup x:Name="ValidationStates"> | |
99 <VisualState x:Name="Valid" /> | |
100 <VisualState x:Name="InvalidUnfocused"> | |
101 <Storyboard> | |
102 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" | |
103 Storyboard.TargetName="ValidationErrorElement"> | |
104 <DiscreteObjectKeyFrame KeyTime="0"> | |
105 <DiscreteObjectKeyFrame.Value> | |
106 <Visibility>Visible</Visibility> | |
107 </DiscreteObjectKeyFrame.Value> | |
108 </DiscreteObjectKeyFrame> | |
109 </ObjectAnimationUsingKeyFrames> | |
110 </Storyboard> | |
111 </VisualState> | |
112 <VisualState x:Name="InvalidFocused"> | |
113 <Storyboard> | |
114 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" | |
115 Storyboard.TargetName="ValidationErrorElement"> | |
116 <DiscreteObjectKeyFrame KeyTime="0"> | |
117 <DiscreteObjectKeyFrame.Value> | |
118 <Visibility>Visible</Visibility> | |
119 </DiscreteObjectKeyFrame.Value> | |
120 </DiscreteObjectKeyFrame> | |
121 </ObjectAnimationUsingKeyFrames> | |
122 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen" | |
123 Storyboard.TargetName="validationTooltip"> | |
124 <DiscreteObjectKeyFrame KeyTime="0"> | |
125 <DiscreteObjectKeyFrame.Value> | |
126 <System:Boolean>True</System:Boolean> | |
127 </DiscreteObjectKeyFrame.Value> | |
128 </DiscreteObjectKeyFrame> | |
129 </ObjectAnimationUsingKeyFrames> | |
130 </Storyboard> | |
131 </VisualState> | |
132 </VisualStateGroup> | |
133 </VisualStateManager.VisualStateGroups> | |
134 <Rectangle x:Name="Base" | |
135 Stroke="{TemplateBinding BorderBrush}" | |
136 StrokeThickness="{TemplateBinding BorderThickness}" | |
137 Opacity="1" | |
138 Fill="{TemplateBinding Background}" /> | |
139 <Rectangle x:Name="FocusRectangle" | |
140 StrokeThickness="{TemplateBinding BorderThickness}" | |
141 Opacity="0" | |
142 Stroke="{DynamicResource TextBoxMouseOverBorderBrush}" /> | |
143 <Rectangle x:Name="FocusInnerRectangle" | |
144 StrokeThickness="{TemplateBinding BorderThickness}" | |
145 Opacity="0" | |
146 Margin="1" | |
147 Stroke="{DynamicResource TextBoxMouseOverInnerBorderBrush}" /> | |
148 <Grid Margin="0,1,0,0" > | |
149 <Border x:Name="ReadOnlyVisualElement" | |
150 Background="{x:Null}" | |
151 Opacity="0"/> | |
152 <Grid Margin="8,0,0,0"> | |
153 <ScrollViewer x:Name="PART_ContentHost" | |
154 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |
155 <ContentPresenter x:Name="PART_WatermarkHost" | |
156 Content="{TemplateBinding Watermark}" | |
157 ContentTemplate="{TemplateBinding WatermarkTemplate}" | |
158 VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |
159 HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |
160 IsHitTestVisible="False" | |
161 Margin="{TemplateBinding Padding}" | |
162 Visibility="Collapsed"/> | |
163 | |
164 </Grid> | |
165 </Grid> | |
166 <Rectangle x:Name="DisabledVisualElement" | |
167 Stroke="{DynamicResource ControlsDisabledBrush}" | |
168 StrokeThickness="{TemplateBinding BorderThickness}" | |
169 Fill="{DynamicResource ControlsDisabledBrush}" | |
170 IsHitTestVisible="False" | |
171 Opacity="0" /> | |
172 <Border x:Name="ValidationErrorElement" | |
173 BorderBrush="{DynamicResource ControlsValidationBrush}" | |
174 BorderThickness="1" | |
175 Visibility="Collapsed"> | |
176 <ToolTipService.ToolTip> | |
177 <ToolTip x:Name="validationTooltip" | |
178 DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" | |
179 Placement="Right" | |
180 PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" | |
181 Template="{DynamicResource ValidationToolTipTemplate}"> | |
182 <ToolTip.Triggers> | |
183 <EventTrigger RoutedEvent="Canvas.Loaded"> | |
184 <BeginStoryboard> | |
185 <Storyboard> | |
186 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" | |
187 Storyboard.TargetName="validationTooltip"> | |
188 <DiscreteObjectKeyFrame KeyTime="0"> | |
189 <DiscreteObjectKeyFrame.Value> | |
190 <System:Boolean>true</System:Boolean> | |
191 </DiscreteObjectKeyFrame.Value> | |
192 </DiscreteObjectKeyFrame> | |
193 </ObjectAnimationUsingKeyFrames> | |
194 </Storyboard> | |
195 </BeginStoryboard> | |
196 </EventTrigger> | |
197 </ToolTip.Triggers> | |
198 </ToolTip> | |
199 </ToolTipService.ToolTip> | |
200 <Grid Background="Transparent" | |
201 HorizontalAlignment="Right" | |
202 Height="12" | |
203 Margin="1,-4,-4,0" | |
204 VerticalAlignment="Top" | |
205 Width="12"> | |
206 <Path Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" | |
207 Fill="{DynamicResource ValidationBrush5}" | |
208 Margin="1,3,0,0" /> | |
209 <Path Data="M 0,0 L2,0 L 8,6 L8,8" | |
210 Fill="{DynamicResource WhiteColorBrush}" | |
211 Margin="1,3,0,0" /> | |
212 </Grid> | |
213 </Border> | |
214 </Grid> | |
215 <ControlTemplate.Triggers> | |
216 <MultiTrigger> | |
217 <MultiTrigger.Conditions> | |
218 <Condition Property="IsFocused" Value="False"></Condition> | |
219 <Condition Property="Text" Value=""></Condition> | |
220 </MultiTrigger.Conditions> | |
221 <MultiTrigger.Setters> | |
222 <Setter Property="Visibility" TargetName="PART_WatermarkHost" Value="Visible"></Setter> | |
223 </MultiTrigger.Setters> | |
224 </MultiTrigger> | |
225 </ControlTemplate.Triggers> | |
226 </ControlTemplate> | |
227 </Setter.Value> | |
228 </Setter> | |
229 </Style> | |
230 | |
231 </ResourceDictionary> |