Skip to content

Commit 5189907

Browse files
committed
Make TextBoxErrorTemplate look like current Rename UI error
1 parent dcbb979 commit 5189907

File tree

1 file changed

+44
-47
lines changed

1 file changed

+44
-47
lines changed

Rubberduck.Core/UI/Refactorings/AnnotateDeclaration/AnnotateDeclarationView.xaml

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<Setter Property="Validation.ErrorTemplate">
2626
<Setter.Value>
2727
<ControlTemplate x:Name="TextBoxErrorTemplate">
28-
<StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
29-
<AdornedElementPlaceholder/>
28+
<Grid>
29+
<AdornedElementPlaceholder Grid.Row="0"/>
3030
<Image Source="{StaticResource InvalidTextImage}"
3131
Height="16"
3232
Margin="0,-8,-8,0"
3333
HorizontalAlignment="Right"
3434
VerticalAlignment="Top"/>
35-
</StackPanel>
35+
</Grid>
3636
</ControlTemplate>
3737
</Setter.Value>
3838
</Setter>
@@ -55,10 +55,9 @@
5555
<TextBlock Text="{Binding ArgumentType, Converter={StaticResource AnnotationArgumentTypeToStringConverter}}"/>
5656
</DataTemplate>
5757
<DataTemplate DataType="{x:Type local:IAnnotationArgumentViewModel}" x:Key="ArgumentMultiTypeTemplate">
58-
<ComboBox
59-
ItemsSource="{Binding Path=ApplicableArgumentTypes}"
60-
SelectedItem="{Binding Path=ArgumentType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
61-
IsSynchronizedWithCurrentItem="True">
58+
<ComboBox ItemsSource="{Binding Path=ApplicableArgumentTypes}"
59+
SelectedItem="{Binding Path=ArgumentType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
60+
IsSynchronizedWithCurrentItem="True">
6261
<ComboBox.ItemTemplate>
6362
<DataTemplate DataType="{x:Type annotations:AnnotationArgumentType}">
6463
<TextBlock Text="{Binding Path=., Converter={StaticResource AnnotationArgumentTypeToStringConverter}}"/>
@@ -77,23 +76,27 @@
7776
<DataTemplate.Resources>
7877
<CollectionViewSource Source="{Binding InspectionNames}" x:Key="InspectionNamesView" />
7978
</DataTemplate.Resources>
80-
<StackPanel>
79+
<StackPanel VerticalAlignment="Center">
8180
<TextBox Text="{Binding ArgumentValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
8281
Style="{StaticResource TextBoxErrorStyle}"
82+
HorizontalAlignment="Stretch"
83+
VerticalAlignment="Stretch"
8384
Visibility="{Binding ArgumentType, Converter={StaticResource DefaultArgumentVisibilityConverter}}">
8485
</TextBox>
85-
<ComboBox
86-
Visibility="{Binding ArgumentType, Converter={StaticResource BooleanArgumentVisibilityConverter}}"
87-
ItemsSource="{Binding Path=BooleanValues}"
88-
SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}">
86+
<ComboBox Visibility="{Binding ArgumentType, Converter={StaticResource BooleanArgumentVisibilityConverter}}"
87+
ItemsSource="{Binding Path=BooleanValues}"
88+
SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
89+
HorizontalAlignment="Stretch"
90+
VerticalAlignment="Stretch">
8991
</ComboBox>
90-
<ComboBox
91-
Visibility="{Binding ArgumentType, Converter={StaticResource InspectionArgumentVisibilityConverter}}"
92-
ItemsSource="{Binding Path=InspectionNames}"
93-
SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}">
92+
<ComboBox Visibility="{Binding ArgumentType, Converter={StaticResource InspectionArgumentVisibilityConverter}}"
93+
ItemsSource="{Binding Path=InspectionNames}"
94+
SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}">
9495
<ComboBox.ItemTemplate>
9596
<DataTemplate>
96-
<TextBlock Text="{Binding Path=., Converter={StaticResource InspectionToLocalizedNameConverter}, UpdateSourceTrigger=PropertyChanged}"/>
97+
<TextBlock Text="{Binding Path=., Converter={StaticResource InspectionToLocalizedNameConverter}, UpdateSourceTrigger=PropertyChanged}"
98+
HorizontalAlignment="Stretch"
99+
VerticalAlignment="Stretch"/>
97100
</DataTemplate>
98101
</ComboBox.ItemTemplate>
99102
</ComboBox>
@@ -116,11 +119,10 @@
116119
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_DeclarationLabel}" FontWeight="DemiBold" />
117120
<TextBlock Text="{Binding Model.Target, Converter={StaticResource DeclarationToQualifiedNameConverter}}" Margin="5,0,0,5" FontWeight="Regular" />
118121
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_AnnotationLabel}" FontWeight="DemiBold" />
119-
<ComboBox
120-
ItemsSource="{Binding ApplicableAnnotations}"
121-
SelectedItem="{Binding Annotation}"
122-
IsSynchronizedWithCurrentItem="True"
123-
Margin="5,0,5,5">
122+
<ComboBox ItemsSource="{Binding ApplicableAnnotations}"
123+
SelectedItem="{Binding Annotation}"
124+
IsSynchronizedWithCurrentItem="True"
125+
Margin="5,0,5,5">
124126
<ComboBox.ItemTemplate>
125127
<DataTemplate DataType="{x:Type annotations:IAnnotation}">
126128
<TextBlock Text="{Binding Path=., Converter={StaticResource AnnotationToCodeStringConverter}}"/>
@@ -133,14 +135,12 @@
133135
<ColumnDefinition Width="*" />
134136
<ColumnDefinition Width="auto" />
135137
</Grid.ColumnDefinitions>
136-
<Label
137-
Grid.Column="0"
138-
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentsLabel}"
139-
FontWeight="DemiBold"
140-
Margin="5,5,0,0" />
141-
<StackPanel
142-
Grid.Column="1"
143-
Orientation="Horizontal">
138+
<Label Grid.Column="0"
139+
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentsLabel}"
140+
FontWeight="DemiBold"
141+
Margin="5,5,0,0" />
142+
<StackPanel Grid.Column="1"
143+
Orientation="Horizontal">
144144
<Button Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_AddArgumentButtonLabel}"
145145
Height="20"
146146
Margin="5,2.5"
@@ -153,24 +153,21 @@
153153
Command="{Binding RemoveAnnotationArgument}"/>
154154
</StackPanel>
155155
</Grid>
156-
<DataGrid
157-
Grid.Row="3"
158-
VerticalAlignment="Stretch"
159-
ItemsSource="{Binding Path=AnnotationArguments}"
160-
AutoGenerateColumns="False"
161-
VerticalScrollBarVisibility="Auto"
162-
Margin="5,0,0,5">
156+
<DataGrid Grid.Row="3"
157+
VerticalAlignment="Stretch"
158+
ItemsSource="{Binding Path=AnnotationArguments}"
159+
AutoGenerateColumns="False"
160+
VerticalScrollBarVisibility="Auto"
161+
Margin="5,0,0,5">
163162
<DataGrid.Columns>
164-
<DataGridTemplateColumn
165-
Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentTypeHeader}"
166-
CellTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}"
167-
CellEditingTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}"
168-
Width="Auto"/>
169-
<DataGridTemplateColumn
170-
Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentValueHeader}"
171-
CellTemplate="{StaticResource ArgumentValueTemplate}"
172-
CellEditingTemplate="{StaticResource ArgumentValueTemplate}"
173-
Width="*"/>
163+
<DataGridTemplateColumn Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentTypeHeader}"
164+
CellTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}"
165+
CellEditingTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}"
166+
Width="Auto"/>
167+
<DataGridTemplateColumn Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentValueHeader}"
168+
CellTemplate="{StaticResource ArgumentValueTemplate}"
169+
CellEditingTemplate="{StaticResource ArgumentValueTemplate}"
170+
Width="*"/>
174171
</DataGrid.Columns>
175172
</DataGrid>
176173
<Grid Grid.Row="4" Background="{x:Static SystemColors.ControlDarkBrush}" Grid.IsSharedSizeScope="True">

0 commit comments

Comments
 (0)