|
50 | 50 | </UserControl.Resources>
|
51 | 51 |
|
52 | 52 | <Grid>
|
| 53 | + <Grid.Resources> |
| 54 | + <DataTemplate DataType="{x:Type local:IAnnotationArgumentViewModel}" x:Key="ArgumentSingleTypeTemplate"> |
| 55 | + <TextBlock Text="{Binding ArgumentType, Converter={StaticResource AnnotationArgumentTypeToStringConverter}}"/> |
| 56 | + </DataTemplate> |
| 57 | + <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"> |
| 62 | + <ComboBox.ItemTemplate> |
| 63 | + <DataTemplate DataType="{x:Type annotations:AnnotationArgumentType}"> |
| 64 | + <TextBlock Text="{Binding Path=., Converter={StaticResource AnnotationArgumentTypeToStringConverter}}"/> |
| 65 | + </DataTemplate> |
| 66 | + </ComboBox.ItemTemplate> |
| 67 | + </ComboBox> |
| 68 | + </DataTemplate> |
| 69 | + <x:Array Type="sys:Object" xmlns:sys="clr-namespace:System;assembly=mscorlib" x:Key="NonDefaultInputArgumentTypes"> |
| 70 | + <annotations:AnnotationArgumentType>Boolean</annotations:AnnotationArgumentType> |
| 71 | + <annotations:AnnotationArgumentType>Inspection</annotations:AnnotationArgumentType> |
| 72 | + </x:Array> |
| 73 | + <converters:SpecificValuesToVisibilityConverter SpecialValues="{StaticResource NonDefaultInputArgumentTypes}" CollapseSpecialValues="True" x:Key="DefaultArgumentVisibilityConverter"/> |
| 74 | + <converters:SpecificValueToVisibilityConverter SpecialValue="{x:Static annotations:AnnotationArgumentType.Boolean}" CollapseSpecialValue="False" x:Key="BooleanArgumentVisibilityConverter"/> |
| 75 | + <converters:SpecificValueToVisibilityConverter SpecialValue="{x:Static annotations:AnnotationArgumentType.Inspection}" CollapseSpecialValue="False" x:Key="InspectionArgumentVisibilityConverter"/> |
| 76 | + <DataTemplate DataType="{x:Type local:IAnnotationArgumentViewModel}" x:Key="ArgumentValueTemplate"> |
| 77 | + <DataTemplate.Resources> |
| 78 | + <CollectionViewSource Source="{Binding InspectionNames}" x:Key="InspectionNamesView"> |
| 79 | + <CollectionViewSource.SortDescriptions> |
| 80 | + <scm:SortDescription PropertyName="." /> |
| 81 | + <!-- This is not really the sort we want. We want a converter here, which is impossible. --> |
| 82 | + </CollectionViewSource.SortDescriptions> |
| 83 | + </CollectionViewSource> |
| 84 | + </DataTemplate.Resources> |
| 85 | + <StackPanel> |
| 86 | + <TextBox Text="{Binding ArgumentValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" |
| 87 | + Style="{StaticResource TextBoxErrorStyle}" |
| 88 | + Visibility="{Binding ArgumentType, Converter={StaticResource DefaultArgumentVisibilityConverter}}"> |
| 89 | + </TextBox> |
| 90 | + <ComboBox |
| 91 | + Visibility="{Binding ArgumentType, Converter={StaticResource BooleanArgumentVisibilityConverter}}" |
| 92 | + ItemsSource="{Binding Path=BooleanValues}" |
| 93 | + SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"> |
| 94 | + </ComboBox> |
| 95 | + <ComboBox |
| 96 | + Visibility="{Binding ArgumentType, Converter={StaticResource InspectionArgumentVisibilityConverter}}" |
| 97 | + ItemsSource="{Binding Path=InspectionNames}" |
| 98 | + SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"> |
| 99 | + <ComboBox.ItemTemplate> |
| 100 | + <DataTemplate> |
| 101 | + <TextBlock Text="{Binding Path=., Converter={StaticResource InspectionToLocalizedNameConverter}, UpdateSourceTrigger=PropertyChanged}"/> |
| 102 | + </DataTemplate> |
| 103 | + </ComboBox.ItemTemplate> |
| 104 | + </ComboBox> |
| 105 | + </StackPanel> |
| 106 | + </DataTemplate> |
| 107 | + <local:AnnotationArgumentTypeCellDataTemplateSelector x:Key="AnnotationArgumentTypeCellDataTemplateSelector"/> |
| 108 | + </Grid.Resources> |
53 | 109 | <Grid.RowDefinitions>
|
| 110 | + <RowDefinition Height="Auto" /> |
54 | 111 | <RowDefinition Height="Auto" />
|
55 | 112 | <RowDefinition Height="Auto" />
|
56 | 113 | <RowDefinition Height="*" />
|
|
68 | 125 | ItemsSource="{Binding ApplicableAnnotations}"
|
69 | 126 | SelectedItem="{Binding Annotation}"
|
70 | 127 | IsSynchronizedWithCurrentItem="True"
|
71 |
| - Margin="5,0"> |
| 128 | + Margin="5,0,5,5"> |
72 | 129 | <ComboBox.ItemTemplate>
|
73 | 130 | <DataTemplate DataType="{x:Type annotations:IAnnotation}">
|
74 | 131 | <TextBlock Text="{Binding Path=., Converter={StaticResource AnnotationToCodeStringConverter}}"/>
|
75 | 132 | </DataTemplate>
|
76 | 133 | </ComboBox.ItemTemplate>
|
77 | 134 | </ComboBox>
|
78 |
| - <Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentsLabel}" FontWeight="DemiBold" Margin="5,5,0,0" /> |
79 | 135 | </StackPanel>
|
80 | 136 | <Grid Grid.Row="2">
|
81 | 137 | <Grid.ColumnDefinitions>
|
82 | 138 | <ColumnDefinition Width="*" />
|
83 | 139 | <ColumnDefinition Width="auto" />
|
84 | 140 | </Grid.ColumnDefinitions>
|
85 |
| - <Grid.Resources> |
86 |
| - <DataTemplate DataType="{x:Type local:IAnnotationArgumentViewModel}" x:Key="ArgumentSingleTypeTemplate"> |
87 |
| - <TextBlock Text="{Binding ArgumentType, Converter={StaticResource AnnotationArgumentTypeToStringConverter}}"/> |
88 |
| - </DataTemplate> |
89 |
| - <DataTemplate DataType="{x:Type local:IAnnotationArgumentViewModel}" x:Key="ArgumentMultiTypeTemplate"> |
90 |
| - <ComboBox |
91 |
| - ItemsSource="{Binding Path=ApplicableArgumentTypes}" |
92 |
| - SelectedItem="{Binding Path=ArgumentType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" |
93 |
| - IsSynchronizedWithCurrentItem="True"> |
94 |
| - <ComboBox.ItemTemplate> |
95 |
| - <DataTemplate DataType="{x:Type annotations:AnnotationArgumentType}"> |
96 |
| - <TextBlock Text="{Binding Path=., Converter={StaticResource AnnotationArgumentTypeToStringConverter}}"/> |
97 |
| - </DataTemplate> |
98 |
| - </ComboBox.ItemTemplate> |
99 |
| - </ComboBox> |
100 |
| - </DataTemplate> |
101 |
| - <x:Array Type="sys:Object" xmlns:sys="clr-namespace:System;assembly=mscorlib" x:Key="NonDefaultInputArgumentTypes"> |
102 |
| - <annotations:AnnotationArgumentType>Boolean</annotations:AnnotationArgumentType> |
103 |
| - <annotations:AnnotationArgumentType>Inspection</annotations:AnnotationArgumentType> |
104 |
| - </x:Array> |
105 |
| - <converters:SpecificValuesToVisibilityConverter SpecialValues="{StaticResource NonDefaultInputArgumentTypes}" CollapseSpecialValues="True" x:Key="DefaultArgumentVisibilityConverter"/> |
106 |
| - <converters:SpecificValueToVisibilityConverter SpecialValue="{x:Static annotations:AnnotationArgumentType.Boolean}" CollapseSpecialValue="False" x:Key="BooleanArgumentVisibilityConverter"/> |
107 |
| - <converters:SpecificValueToVisibilityConverter SpecialValue="{x:Static annotations:AnnotationArgumentType.Inspection}" CollapseSpecialValue="False" x:Key="InspectionArgumentVisibilityConverter"/> |
108 |
| - <DataTemplate DataType="{x:Type local:IAnnotationArgumentViewModel}" x:Key="ArgumentValueTemplate"> |
109 |
| - <DataTemplate.Resources> |
110 |
| - <CollectionViewSource Source="{Binding InspectionNames}" x:Key="InspectionNamesView"> |
111 |
| - <CollectionViewSource.SortDescriptions> |
112 |
| - <scm:SortDescription PropertyName="." /> <!-- This is not really the sort we want. We want a converter here, which is impossible. --> |
113 |
| - </CollectionViewSource.SortDescriptions> |
114 |
| - </CollectionViewSource> |
115 |
| - </DataTemplate.Resources> |
116 |
| - <StackPanel> |
117 |
| - <TextBox Text="{Binding ArgumentValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" |
118 |
| - Style="{StaticResource TextBoxErrorStyle}" |
119 |
| - Visibility="{Binding ArgumentType, Converter={StaticResource DefaultArgumentVisibilityConverter}}"> |
120 |
| - </TextBox> |
121 |
| - <ComboBox |
122 |
| - Visibility="{Binding ArgumentType, Converter={StaticResource BooleanArgumentVisibilityConverter}}" |
123 |
| - ItemsSource="{Binding Path=BooleanValues}" |
124 |
| - SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"> |
125 |
| - </ComboBox> |
126 |
| - <ComboBox |
127 |
| - Visibility="{Binding ArgumentType, Converter={StaticResource InspectionArgumentVisibilityConverter}}" |
128 |
| - ItemsSource="{Binding Path=InspectionNames}" |
129 |
| - SelectedItem="{Binding Path=ArgumentValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"> |
130 |
| - <ComboBox.ItemTemplate> |
131 |
| - <DataTemplate> |
132 |
| - <TextBlock Text="{Binding Path=., Converter={StaticResource InspectionToLocalizedNameConverter}, UpdateSourceTrigger=PropertyChanged}"/> |
133 |
| - </DataTemplate> |
134 |
| - </ComboBox.ItemTemplate> |
135 |
| - </ComboBox> |
136 |
| - </StackPanel> |
137 |
| - </DataTemplate> |
138 |
| - <local:AnnotationArgumentTypeCellDataTemplateSelector x:Key="AnnotationArgumentTypeCellDataTemplateSelector"/> |
139 |
| - </Grid.Resources> |
140 |
| - <DataGrid |
141 |
| - Grid.Column="0" |
142 |
| - VerticalAlignment="Stretch" |
143 |
| - ItemsSource="{Binding Path=AnnotationArguments}" |
144 |
| - AutoGenerateColumns="False" |
145 |
| - VerticalScrollBarVisibility="Auto" |
146 |
| - Margin="5,0,0,5"> |
147 |
| - <DataGrid.Columns> |
148 |
| - <DataGridTemplateColumn |
149 |
| - Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentTypeHeader}" |
150 |
| - CellTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}" |
151 |
| - CellEditingTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}" |
152 |
| - Width="Auto"/> |
153 |
| - <DataGridTemplateColumn |
154 |
| - Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentValueHeader}" |
155 |
| - CellTemplate="{StaticResource ArgumentValueTemplate}" |
156 |
| - CellEditingTemplate="{StaticResource ArgumentValueTemplate}" |
157 |
| - Width="*"/> |
158 |
| - </DataGrid.Columns> |
159 |
| - </DataGrid> |
| 141 | + <Label |
| 142 | + Grid.Column="0" |
| 143 | + Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentsLabel}" |
| 144 | + FontWeight="DemiBold" |
| 145 | + Margin="5,5,0,0" /> |
160 | 146 | <StackPanel
|
161 | 147 | Grid.Column="1"
|
162 |
| - VerticalAlignment="Center"> |
| 148 | + Orientation="Horizontal"> |
163 | 149 | <Button Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_AddArgumentButtonLabel}"
|
164 | 150 | Height="20"
|
165 | 151 | Margin="5,2.5"
|
|
172 | 158 | Command="{Binding RemoveAnnotationArgument}"/>
|
173 | 159 | </StackPanel>
|
174 | 160 | </Grid>
|
175 |
| - <Grid Grid.Row="3" Background="{x:Static SystemColors.ControlDarkBrush}" Grid.IsSharedSizeScope="True"> |
| 161 | + <DataGrid |
| 162 | + Grid.Row="3" |
| 163 | + VerticalAlignment="Stretch" |
| 164 | + ItemsSource="{Binding Path=AnnotationArguments}" |
| 165 | + AutoGenerateColumns="False" |
| 166 | + VerticalScrollBarVisibility="Auto" |
| 167 | + Margin="5,0,0,5"> |
| 168 | + <DataGrid.Columns> |
| 169 | + <DataGridTemplateColumn |
| 170 | + Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentTypeHeader}" |
| 171 | + CellTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}" |
| 172 | + CellEditingTemplateSelector="{StaticResource AnnotationArgumentTypeCellDataTemplateSelector}" |
| 173 | + Width="Auto"/> |
| 174 | + <DataGridTemplateColumn |
| 175 | + Header="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentValueHeader}" |
| 176 | + CellTemplate="{StaticResource ArgumentValueTemplate}" |
| 177 | + CellEditingTemplate="{StaticResource ArgumentValueTemplate}" |
| 178 | + Width="*"/> |
| 179 | + </DataGrid.Columns> |
| 180 | + </DataGrid> |
| 181 | + <Grid Grid.Row="4" Background="{x:Static SystemColors.ControlDarkBrush}" Grid.IsSharedSizeScope="True"> |
176 | 182 | <Grid HorizontalAlignment="Right"
|
177 | 183 | Margin="5,0">
|
178 | 184 | <Grid.ColumnDefinitions>
|
|
0 commit comments