|
47 | 47 | <Setter.Value>
|
48 | 48 | <ControlTemplate TargetType="{x:Type DatePicker}">
|
49 | 49 | <Grid x:Name="PART_Root">
|
50 |
| - <VisualStateManager.VisualStateGroups> |
51 |
| - <VisualStateGroup x:Name="CommonStates"> |
52 |
| - <VisualState x:Name="Normal" /> |
53 |
| - <VisualState x:Name="Disabled"> |
54 |
| - <Storyboard> |
55 |
| - <DoubleAnimation Duration="0" |
56 |
| - To="1" |
57 |
| - Storyboard.TargetProperty="Opacity" |
58 |
| - Storyboard.TargetName="PART_DisabledVisual" /> |
59 |
| - </Storyboard> |
60 |
| - </VisualState> |
61 |
| - </VisualStateGroup> |
62 |
| - </VisualStateManager.VisualStateGroups> |
63 | 50 | <Border x:Name="Base"
|
64 | 51 | SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
65 | 52 | BorderBrush="{TemplateBinding BorderBrush}"
|
66 | 53 | BorderThickness="{TemplateBinding BorderThickness}"
|
67 | 54 | Background="{TemplateBinding Background}" />
|
68 |
| - <Grid Margin="2"> |
| 55 | + <Grid x:Name="PART_InnerGrid" |
| 56 | + Margin="2"> |
69 | 57 | <Grid.ColumnDefinitions>
|
70 | 58 | <ColumnDefinition Width="*" />
|
71 | 59 | <ColumnDefinition Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualHeight, Mode=OneWay}" />
|
|
102 | 90 |
|
103 | 91 | <DatePickerTextBox x:Name="PART_TextBox"
|
104 | 92 | Grid.Column="0"
|
| 93 | + Controls:TextBoxHelper.Watermark="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:TextBoxHelper.Watermark), Mode=OneWay}" |
105 | 94 | CaretBrush="{DynamicResource BlackBrush}"
|
106 | 95 | ContextMenu="{DynamicResource TextBoxMetroContextMenu}"
|
107 | 96 | Foreground="{TemplateBinding Foreground}"
|
|
110 | 99 | HorizontalContentAlignment="Stretch"
|
111 | 100 | VerticalContentAlignment="Stretch" />
|
112 | 101 |
|
113 |
| - <Border x:Name="PART_DisabledVisual" |
114 |
| - Grid.Column="0" |
115 |
| - Grid.ColumnSpan="2" |
116 |
| - BorderBrush="{DynamicResource ControlsDisabledBrush}" |
117 |
| - BorderThickness="{TemplateBinding BorderThickness}" |
118 |
| - Background="{DynamicResource ControlsDisabledBrush}" |
119 |
| - IsHitTestVisible="False" |
120 |
| - Opacity="0" /> |
121 |
| - |
122 | 102 | <Popup x:Name="PART_Popup"
|
123 | 103 | AllowsTransparency="True"
|
124 | 104 | Placement="Bottom"
|
125 | 105 | PlacementTarget="{Binding ElementName=PART_Root}"
|
126 | 106 | StaysOpen="False" />
|
127 | 107 | </Grid>
|
| 108 | + <Border x:Name="DisabledVisualElement" |
| 109 | + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
| 110 | + BorderBrush="{DynamicResource ControlsDisabledBrush}" |
| 111 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 112 | + Background="{DynamicResource ControlsDisabledBrush}" |
| 113 | + IsHitTestVisible="False" |
| 114 | + Opacity="0" /> |
128 | 115 | </Grid>
|
129 | 116 |
|
130 | 117 | <ControlTemplate.Triggers>
|
|
146 | 133 | Property="BorderBrush"
|
147 | 134 | Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.FocusBorderBrush)}" />
|
148 | 135 | </Trigger>
|
| 136 | + <Trigger Property="IsEnabled" |
| 137 | + Value="False"> |
| 138 | + <Setter TargetName="DisabledVisualElement" |
| 139 | + Property="Opacity" |
| 140 | + Value="0.6" /> |
| 141 | + </Trigger> |
149 | 142 | <Trigger SourceName="PART_Button"
|
150 | 143 | Property="IsMouseOver"
|
151 | 144 | Value="True">
|
|
255 | 248 | Foreground="{TemplateBinding Foreground}"
|
256 | 249 | Visibility="Hidden" />
|
257 | 250 | <TextBlock x:Name="Message"
|
258 |
| - Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DatePicker}}, Path=(Controls:TextBoxHelper.Watermark)}" |
| 251 | + Text="{TemplateBinding Controls:TextBoxHelper.Watermark}" |
259 | 252 | Foreground="{TemplateBinding Foreground}"
|
260 | 253 | IsHitTestVisible="False"
|
261 | 254 | Opacity="0.6"
|
|
280 | 273 | </MultiTrigger.ExitActions>
|
281 | 274 | </MultiTrigger>
|
282 | 275 |
|
283 |
| - <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DatePicker}}, Path=(Controls:TextBoxHelper.Watermark)}" |
| 276 | + <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Controls:TextBoxHelper.Watermark)}" |
284 | 277 | Value="{x:Static System:String.Empty}">
|
285 | 278 | <Setter TargetName="PART_Watermark"
|
286 | 279 | Property="Visibility"
|
|
0 commit comments