Skip to content

Commit 76dfde7

Browse files
committed
Simplify bindings by removing VM as an intermediary. Addresses #4597
1 parent 86db27e commit 76dfde7

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

Rubberduck.Core/UI/Inspections/InspectionResultsControl.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@
212212
<ColumnDefinition />
213213
</Grid.ColumnDefinitions>
214214
<Image Style="{StaticResource IconMargin}" VerticalAlignment="Top" Grid.Column="0"
215-
Source="{Binding SelectedSeverity, Converter={StaticResource SeverityIconConverter}}"/>
216-
<TextBlock Grid.Column="1" Margin="4" Text="{Binding SelectedDescription}" FontWeight="Bold" TextWrapping="WrapWithOverflow"/>
215+
Source="{Binding SelectedInspection.Severity, Converter={StaticResource SeverityIconConverter}}"/>
216+
<TextBlock Grid.Column="1" Margin="4" Text="{Binding SelectedInspection.Description}" FontWeight="Bold" TextWrapping="WrapWithOverflow"/>
217217
</Grid>
218218

219-
<TextBlock Margin="4" Text="{Binding SelectedMeta}" FontSize="10" TextWrapping="WrapWithOverflow"/>
220-
<TextBlock Margin="8" Text="{Binding SelectedSelection}" FontSize="10" TextWrapping="WrapWithOverflow" />
219+
<TextBlock Margin="4" Text="{Binding SelectedInspection.Meta}" FontSize="10" TextWrapping="WrapWithOverflow"/>
220+
<TextBlock Margin="8" Text="{Binding SelectedInspection.QualifiedSelection}" FontSize="10" TextWrapping="WrapWithOverflow" />
221221

222222
<WrapPanel>
223223
<controls:LinkButton Margin="4"

Rubberduck.Core/UI/Inspections/InspectionResultsViewModel.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,6 @@ public INavigateSource SelectedItem
160160
_selectedItem = value;
161161
OnPropertyChanged();
162162
OnPropertyChanged(nameof(QuickFixes));
163-
OnPropertyChanged(nameof(SelectedDescription));
164-
OnPropertyChanged(nameof(SelectedMeta));
165-
OnPropertyChanged(nameof(SelectedSeverity));
166-
167163
SelectedInspection = null;
168164
CanQuickFix = false;
169165
CanExecuteQuickFixInProcedure = false;
@@ -173,8 +169,7 @@ public INavigateSource SelectedItem
173169
if (_selectedItem is IInspectionResult inspectionResult)
174170
{
175171
SelectedInspection = inspectionResult.Inspection;
176-
SelectedSelection = inspectionResult.QualifiedSelection;
177-
172+
178173
CanQuickFix = _quickFixProvider.HasQuickFixes(inspectionResult);
179174
_defaultFix = _quickFixProvider.QuickFixes(inspectionResult).FirstOrDefault();
180175
CanExecuteQuickFixInProcedure = _defaultFix != null && _defaultFix.CanFixInProcedure;
@@ -195,18 +190,9 @@ public IInspection SelectedInspection
195190
{
196191
_selectedInspection = value;
197192
OnPropertyChanged();
198-
OnPropertyChanged(nameof(SelectedSelection));
199193
}
200194
}
201195

202-
public string SelectedDescription => SelectedInspection?.Description ?? string.Empty;
203-
204-
public string SelectedMeta => SelectedInspection?.Meta ?? string.Empty;
205-
206-
public CodeInspectionSeverity SelectedSeverity => SelectedInspection?.Severity ?? CodeInspectionSeverity.DoNotShow;
207-
208-
public QualifiedSelection SelectedSelection { get; private set; }
209-
210196
public IEnumerable<DisplayQuickFix> QuickFixes
211197
{
212198
get

0 commit comments

Comments
 (0)