|
41 | 41 | </VisualBrush.Visual> |
42 | 42 | </VisualBrush> |
43 | 43 |
|
44 | | - <!-- Base style for all text-boxes --> |
45 | | - <Style x:Key="BaseTextBoxStyle" TargetType="TextBox"> |
46 | | - <Setter Property="Validation.ErrorTemplate"> |
47 | | - <Setter.Value> |
48 | | - <ControlTemplate> |
49 | | - <DockPanel LastChildFill="True"> |
50 | | - <AdornedElementPlaceholder Name="customAdorner"/> |
51 | | - <Image Source="{StaticResource WarningPngIcon}" Margin="3,0,3,0" VerticalAlignment="Center" |
52 | | - AutomationProperties.Name="WarningError" Stretch="None" ToolTip="{Binding ElementName=customAdorner, |
53 | | - Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" /> |
54 | | - </DockPanel> |
55 | | - </ControlTemplate> |
56 | | - </Setter.Value> |
57 | | - </Setter> |
58 | | - <Style.Triggers> |
59 | | - <Trigger Property="Validation.HasError" Value="true"> |
60 | | - <Setter Property="Background" Value="{DynamicResource VsBrush.ControlEditRequiredBackground}" /> |
61 | | - <Setter Property="Foreground" Value="{DynamicResource VsBrush.ControlEditRequiredHintText}" /> |
62 | | - <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> |
63 | | - </Trigger> |
64 | | - </Style.Triggers> |
| 44 | + <Style x:Key="ErrorImageStyle" TargetType="{x:Type Image}"> |
| 45 | + <Setter Property="AutomationProperties.Name" Value="{x:Static ded:Resources.EnumDialog_Error_AccName}" /> |
| 46 | + <Setter Property="Source" Value="{StaticResource WarningPngIcon}" /> |
| 47 | + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" /> |
| 48 | + <Setter Property="Stretch" Value="None" /> |
| 49 | + <Setter Property="VerticalAlignment" Value="Center" /> |
| 50 | + </Style> |
| 51 | + |
| 52 | + <Style x:Key="BasePopupStyle" TargetType="{x:Type Popup}"> |
| 53 | + <Setter Property="AutomationProperties.Name" Value="{x:Static ded:Resources.EnumDialog_Error_AccName}" /> |
| 54 | + <Setter Property="Margin" Value="3,3,3,3" /> |
| 55 | + <Setter Property="Placement" Value="Bottom" /> |
| 56 | + <Setter Property="VerticalOffset" Value="6" /> |
| 57 | + </Style> |
| 58 | + |
| 59 | + <Style x:Key="EnumTypeNamePopupStyle" TargetType="{x:Type Popup}" BasedOn="{StaticResource BasePopupStyle}"> |
| 60 | + <Setter Property="PlacementTarget" Value="{Binding ElementName=txtEnumTypeNameWarningImage}" /> |
| 61 | + <Style.Triggers> |
| 62 | + <DataTrigger Binding="{Binding ElementName=txtEnumTypeName, Path=(Validation.HasError)}" Value="true" > |
| 63 | + <Setter Property="IsOpen" Value="true"/> |
| 64 | + </DataTrigger> |
| 65 | + </Style.Triggers> |
65 | 66 | </Style> |
66 | 67 |
|
67 | | - <!-- Style for external type name text-box --> |
68 | | - <Style x:Key="ExternalTypeNameStyle" TargetType="TextBox" BasedOn="{StaticResource BaseTextBoxStyle}"> |
| 68 | + <Style x:Key="ExternalTypePopupStyle" TargetType="{x:Type Popup}" BasedOn="{StaticResource BasePopupStyle}"> |
| 69 | + <Setter Property="PlacementTarget" Value="{Binding ElementName=txtExternalTypeWarningImage}" /> |
69 | 70 | <Style.Triggers> |
70 | | - <MultiTrigger> |
71 | | - <MultiTrigger.Conditions> |
72 | | - <Condition Property="Text" Value="" /> |
73 | | - <!-- <Condition Property="IsKeyboardFocusWithin" Value="False"/> --> |
74 | | - </MultiTrigger.Conditions> |
75 | | - <Setter Property="Background" Value="{StaticResource ExternalTypeHint}"/> |
76 | | - </MultiTrigger> |
77 | | - <Trigger Property="Validation.HasError" Value="true"> |
78 | | - <Setter Property="Background" Value="{DynamicResource VsBrush.ControlEditRequiredBackground}" /> |
79 | | - <Setter Property="Foreground" Value="{DynamicResource VsBrush.ControlEditRequiredHintText}" /> |
80 | | - <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> |
81 | | - </Trigger> |
82 | | - <Trigger Property="Visibility" Value="Visible"> |
83 | | - <Trigger.EnterActions> |
84 | | - <BeginStoryboard> |
85 | | - <Storyboard> |
86 | | - <DoubleAnimation Storyboard.TargetProperty="Opacity" |
87 | | - From="0" |
88 | | - To="1" |
89 | | - Duration="0:0:1" /> |
90 | | - </Storyboard> |
91 | | - </BeginStoryboard> |
92 | | - </Trigger.EnterActions> |
93 | | - </Trigger> |
94 | | - </Style.Triggers> |
| 71 | + <DataTrigger Binding="{Binding ElementName=txtExternalType, Path=(Validation.HasError)}" Value="true" > |
| 72 | + <Setter Property="IsOpen" Value="true"/> |
| 73 | + </DataTrigger> |
| 74 | + </Style.Triggers> |
| 75 | + </Style> |
| 76 | + |
| 77 | + <Style x:Key="PopupBorderStyle" TargetType="{x:Type Border}"> |
| 78 | + <Setter Property="BorderThickness" Value="1" /> |
| 79 | + <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.InfoBrushKey}}" /> |
| 80 | + <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.InfoTextBrushKey}}" /> |
| 81 | + </Style> |
| 82 | + |
| 83 | + <Style x:Key="PopupTextBlockStyle" TargetType="{x:Type TextBlock}"> |
| 84 | + <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.InfoBrushKey}}" /> |
| 85 | + <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InfoTextBrushKey}}" /> |
| 86 | + <Setter Property="Margin" Value="4,3,4,3" /> |
| 87 | + <Setter Property="VerticalAlignment" Value="Center" /> |
95 | 88 | </Style> |
96 | 89 |
|
97 | 90 | <Style TargetType="{x:Type DataGridRow}"> |
|
140 | 133 | <TextBlock Grid.Column="0" Grid.Row="0" Text="{x:Static ded:Resources.EnumDialog_NameLabel}" |
141 | 134 | VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="5,5,5,2"/> |
142 | 135 |
|
143 | | - <TextBox Grid.Column="0" Grid.Row="1" |
144 | | - Name="txtEnumTypeName" HorizontalAlignment="Left" |
145 | | - Margin="5,0,5,5" AutomationProperties.Name="{x:Static ded:Resources.EnumDialog_NameLabel}" |
146 | | - Width="250px" TextChanged="OnTextBoxTextChanged" LostFocus="OnTextBoxLostFocus" Style="{StaticResource BaseTextBoxStyle}"> |
147 | | - <TextBox.Text> |
148 | | - <Binding Path="Name"> |
149 | | - <Binding.ValidationRules> |
150 | | - <vm:CellDataInfoValidationRule ValidationStep="UpdatedValue"/> |
151 | | - </Binding.ValidationRules> |
152 | | - </Binding> |
153 | | - </TextBox.Text> |
154 | | - </TextBox> |
| 136 | + <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Horizontal"> |
| 137 | + <TextBox Name="txtEnumTypeName" HorizontalAlignment="Left" |
| 138 | + Margin="5,0,5,5" AutomationProperties.Name="{x:Static ded:Resources.EnumDialog_NameLabel}" |
| 139 | + Width="250px" TextChanged="OnTextBoxTextChanged" LostFocus="OnTextBoxLostFocus" > |
| 140 | + <TextBox.Text> |
| 141 | + <Binding Path="Name"> |
| 142 | + <Binding.ValidationRules> |
| 143 | + <vm:CellDataInfoValidationRule ValidationStep="UpdatedValue"/> |
| 144 | + </Binding.ValidationRules> |
| 145 | + </Binding> |
| 146 | + </TextBox.Text> |
| 147 | + <TextBox.Style> |
| 148 | + <Style TargetType="{x:Type TextBox}"> |
| 149 | + <Style.Triggers> |
| 150 | + <Trigger Property="Validation.HasError" Value="true"> |
| 151 | + <Setter Property="Background" Value="{DynamicResource VsBrush.ControlEditRequiredBackground}" /> |
| 152 | + <Setter Property="Foreground" Value="{DynamicResource VsBrush.ControlEditRequiredHintText}" /> |
| 153 | + <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> |
| 154 | + </Trigger> |
| 155 | + </Style.Triggers> |
| 156 | + </Style> |
| 157 | + </TextBox.Style> |
| 158 | + </TextBox> |
| 159 | + <Image Name="txtEnumTypeNameWarningImage" Margin="3,0,3,5"> |
| 160 | + <Image.Style> |
| 161 | + <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ErrorImageStyle}"> |
| 162 | + <Style.Triggers> |
| 163 | + <DataTrigger Binding="{Binding ElementName=txtEnumTypeName, Path=(Validation.HasError)}" Value="true" > |
| 164 | + <Setter Property="Visibility" Value="Visible"/> |
| 165 | + </DataTrigger> |
| 166 | + <DataTrigger Binding="{Binding ElementName=txtEnumTypeName, Path=(Validation.HasError)}" Value="false" > |
| 167 | + <Setter Property="Visibility" Value="Hidden"/> |
| 168 | + </DataTrigger> |
| 169 | + </Style.Triggers> |
| 170 | + </Style> |
| 171 | + </Image.Style> |
| 172 | + </Image> |
| 173 | + <Popup Style="{StaticResource EnumTypeNamePopupStyle}"> |
| 174 | + <Border Style="{StaticResource PopupBorderStyle}"> |
| 175 | + <TextBlock |
| 176 | + AutomationProperties.Name="{Binding ElementName=txtEnumTypeName, Path=(Validation.Errors)[0].ErrorContent}" |
| 177 | + Style="{StaticResource PopupTextBlockStyle}" |
| 178 | + Text="{Binding ElementName=txtEnumTypeName, Path=(Validation.Errors)[0].ErrorContent}"/> |
| 179 | + </Border> |
| 180 | + </Popup> |
| 181 | + </StackPanel> |
155 | 182 |
|
156 | 183 | <TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static ded:Resources.EnumDialog_UnderlyingTypeLabel}" Margin="5,2,5,2" /> |
157 | 184 |
|
|
173 | 200 | <vm:RowDataInfoValidationRule ValidationStep="UpdatedValue" /> |
174 | 201 | </DataGrid.RowValidationRules> |
175 | 202 | <DataGrid.Columns> |
176 | | - |
| 203 | + |
177 | 204 | <DataGridTextColumn Header="{x:Static ded:Resources.EnumDialog_EnumTypeMemberNameLabel}" CanUserSort="False" MinWidth="225" MaxWidth="325" Width="Auto" AutomationProperties.Name="{x:Static ded:Resources.EnumDialog_EnumTypeMemberNameLabel}"> |
178 | 205 | <DataGridTextColumn.Binding> |
179 | 206 | <Binding Path="Name"> |
|
203 | 230 | <CheckBox Content="{x:Static ded:Resources.EnumDialog_ExternalTypeLabel}" Grid.Column="0" Grid.Row="6" |
204 | 231 | Name="chkReferenceExternalType" VerticalAlignment="Center" Margin="8,5,5,2" Padding="8,0,5,0" IsChecked="{Binding Path=IsReferenceExternalType}" |
205 | 232 | ToolTip="{x:Static ded:Resources.PropertyWindow_Description_EnumExternalTypeAttribute}" Click="OnRefrenceExternalTypeClick"/> |
206 | | - |
207 | | - <Border MaxWidth="{Binding ElementName=chkIsFlag,Path=ActualWidth}" Grid.Column="0" Grid.Row="7" Margin="0,0,0,0" BorderThickness="0,0,0,0"> |
208 | | - <TextBox Margin="23,5,5,5" Name="txtExternalType" HorizontalAlignment="Left" AutomationProperties.Name="{x:Static ded:Resources.EnumDialog_ExternalTypeLabel}" |
209 | | - Width="230px" Style="{StaticResource ExternalTypeNameStyle}" |
210 | | - IsReadOnly="{Binding Path=IsChecked, ElementName=chkReferenceExternalType, Converter={StaticResource InverseBooleanConverter}}" |
211 | | - TextChanged="OnTextBoxTextChanged" LostFocus="OnTextBoxLostFocus"> |
| 233 | + |
| 234 | + <StackPanel Grid.Column="0" Grid.Row="7" Orientation="Horizontal"> |
| 235 | + <Border MaxWidth="{Binding ElementName=chkIsFlag,Path=ActualWidth}" Margin="0,0,0,0" BorderThickness="0,0,0,0"> |
| 236 | + <TextBox Margin="23,5,5,5" Name="txtExternalType" HorizontalAlignment="Left" AutomationProperties.Name="{x:Static ded:Resources.EnumDialog_ExternalTypeLabel}" |
| 237 | + Width="230px" IsReadOnly="{Binding Path=IsChecked, ElementName=chkReferenceExternalType, Converter={StaticResource InverseBooleanConverter}}" |
| 238 | + TextChanged="OnTextBoxTextChanged" LostFocus="OnTextBoxLostFocus"> |
212 | 239 | <TextBox.Text> |
213 | 240 | <Binding Path="ExternalTypeName"> |
214 | 241 | <Binding.ValidationRules> |
215 | 242 | <vm:CellDataInfoValidationRule ValidationStep="UpdatedValue"/> |
216 | 243 | </Binding.ValidationRules> |
217 | 244 | </Binding> |
218 | 245 | </TextBox.Text> |
219 | | - </TextBox> |
220 | | - </Border> |
221 | | - |
| 246 | + <TextBox.Style> |
| 247 | + <Style TargetType="{x:Type TextBox}"> |
| 248 | + <Style.Triggers> |
| 249 | + <MultiTrigger> |
| 250 | + <MultiTrigger.Conditions> |
| 251 | + <Condition Property="Text" Value="" /> |
| 252 | + <!-- <Condition Property="IsKeyboardFocusWithin" Value="False"/> --> |
| 253 | + </MultiTrigger.Conditions> |
| 254 | + <Setter Property="Background" Value="{StaticResource ExternalTypeHint}"/> |
| 255 | + </MultiTrigger> |
| 256 | + <Trigger Property="Validation.HasError" Value="true"> |
| 257 | + <Setter Property="Background" Value="{DynamicResource VsBrush.ControlEditRequiredBackground}" /> |
| 258 | + <Setter Property="Foreground" Value="{DynamicResource VsBrush.ControlEditRequiredHintText}" /> |
| 259 | + <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> |
| 260 | + </Trigger> |
| 261 | + <Trigger Property="Visibility" Value="Visible"> |
| 262 | + <Trigger.EnterActions> |
| 263 | + <BeginStoryboard> |
| 264 | + <Storyboard> |
| 265 | + <DoubleAnimation Storyboard.TargetProperty="Opacity" |
| 266 | + From="0" |
| 267 | + To="1" |
| 268 | + Duration="0:0:1" /> |
| 269 | + </Storyboard> |
| 270 | + </BeginStoryboard> |
| 271 | + </Trigger.EnterActions> |
| 272 | + </Trigger> |
| 273 | + </Style.Triggers> |
| 274 | + </Style> |
| 275 | + </TextBox.Style> |
| 276 | + </TextBox> |
| 277 | + </Border> |
| 278 | + <Image Name="txtExternalTypeWarningImage" Margin="3,0,3,2"> |
| 279 | + <Image.Style> |
| 280 | + <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ErrorImageStyle}"> |
| 281 | + <Style.Triggers> |
| 282 | + <DataTrigger Binding="{Binding ElementName=txtExternalType, Path=(Validation.HasError)}" Value="true" > |
| 283 | + <Setter Property="Visibility" Value="Visible"/> |
| 284 | + </DataTrigger> |
| 285 | + <DataTrigger Binding="{Binding ElementName=txtExternalType, Path=(Validation.HasError)}" Value="false" > |
| 286 | + <Setter Property="Visibility" Value="Hidden"/> |
| 287 | + </DataTrigger> |
| 288 | + </Style.Triggers> |
| 289 | + </Style> |
| 290 | + </Image.Style> |
| 291 | + </Image> |
| 292 | + <Popup Style="{StaticResource ExternalTypePopupStyle}"> |
| 293 | + <Border Style="{StaticResource PopupBorderStyle}"> |
| 294 | + <TextBlock |
| 295 | + AutomationProperties.Name="{Binding ElementName=txtExternalType, Path=(Validation.Errors)[0].ErrorContent}" |
| 296 | + Style="{StaticResource PopupTextBlockStyle}" |
| 297 | + Text="{Binding ElementName=txtExternalType, Path=(Validation.Errors)[0].ErrorContent}"/> |
| 298 | + </Border> |
| 299 | + </Popup> |
| 300 | + </StackPanel> |
| 301 | + |
222 | 302 | <StackPanel Grid.Column="0" Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Right"> |
223 | 303 | <Button Name="btnOk" |
224 | 304 | Margin="5,15,5,5" MinWidth="70" IsDefault="True" |
225 | 305 | Click="btnOk_Click" Content="{x:Static ded:Resources.EnumDialog_OkButtonLabel}" |
226 | 306 | IsEnabled="{Binding Path=IsValid}" |
227 | 307 | AutomationProperties.Name="{x:Static ded:Resources.EnumDialog_OkButtonLabel}"/> |
228 | | - |
| 308 | + |
229 | 309 | <Button Name="btnCancel" |
230 | 310 | Margin="5,15,5,5" MinWidth="70" IsCancel="True" |
231 | 311 | Click="btnCancel_Click" Content="{x:Static ded:Resources.EnumDialog_CancelButtonLabel}" |
|
0 commit comments