Skip to content

Commit 45ff0ff

Browse files
aclinickCopilot
andauthored
Fix #15 (round 2): bind finding-pane visibility to explicit bool (#19)
The Click handler from the previous commit fired correctly but the pane still didn't collapse, because the visibility binding `{x:Bind local:MainPage.NullToCollapsed(ViewModel.SelectedFinding)}` wasn't re-evaluating reliably after the property cleared. - New observable bool MainPageViewModel.IsFindingDetailVisible, kept in sync with SelectedFinding via a partial OnSelectedFindingChanged hook. - Pane Visibility now binds to BoolToVisibility(IsFindingDetailVisible). - Close handler also sets IsFindingDetailVisible = false explicitly. - BtnCloseFinding bumped to 32x32 with bigger glyph for a reliable hit target. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f11f85d commit 45ff0ff

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

MSIXplainer/MainPage.xaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,20 +511,21 @@
511511

512512
<!-- ── FINDING DETAIL PANE (shared, right side) ── -->
513513
<Border Grid.Column="1" Width="380"
514-
Visibility="{x:Bind local:MainPage.NullToCollapsed(ViewModel.SelectedFinding), Mode=OneWay}"
514+
Visibility="{x:Bind local:MainPage.BoolToVisibility(ViewModel.IsFindingDetailVisible), Mode=OneWay}"
515515
Background="{ThemeResource LayerFillColorDefaultBrush}"
516516
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
517517
BorderThickness="1,0,0,0">
518518
<ScrollViewer Padding="20,16,20,24">
519519
<StackPanel Spacing="16">
520520
<!-- Close button -->
521521
<Button AutomationProperties.AutomationId="BtnCloseFinding"
522+
AutomationProperties.Name="Close finding details"
522523
HorizontalAlignment="Right"
523524
Click="OnCloseFindingClick"
524-
Padding="4" MinWidth="0" MinHeight="0"
525+
Padding="8" MinWidth="32" MinHeight="32"
525526
Background="Transparent" BorderThickness="0"
526527
ToolTipService.ToolTip="Close">
527-
<FontIcon Glyph="&#xE711;" FontSize="12" />
528+
<FontIcon Glyph="&#xE711;" FontSize="14" />
528529
</Button>
529530

530531
<!-- Header -->

MSIXplainer/MainPage.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,15 @@ private void ViewFinding_Click(object sender, RoutedEventArgs e)
200200
/// <summary>
201201
/// Closes the finding detail pane. Clears the OverviewFindingsList selection
202202
/// explicitly first so the TwoWay binding can't immediately re-push the old
203-
/// selection back into ViewModel.SelectedFinding once we null it.
203+
/// selection back into ViewModel.SelectedFinding once we null it. Then
204+
/// explicitly toggles IsFindingDetailVisible so the pane collapses even if
205+
/// the SelectedFinding PropertyChanged notification gets coalesced.
204206
/// </summary>
205207
private void OnCloseFindingClick(object sender, RoutedEventArgs e)
206208
{
207209
OverviewFindingsList.SelectedItem = null;
208210
ViewModel.SelectedFinding = null;
211+
ViewModel.IsFindingDetailVisible = false;
209212
}
210213

211214
/// <summary>

MSIXplainer/ViewModels/MainPageViewModel.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ public partial class MainPageViewModel : ObservableObject
2525
[ObservableProperty]
2626
public partial ManifestFinding? SelectedFinding { get; set; }
2727

28+
/// <summary>
29+
/// Whether the right-side finding-detail pane should be visible. Tracked as a
30+
/// distinct observable bool (rather than binding visibility to a
31+
/// NullToCollapsed function on SelectedFinding) because the x:Bind function
32+
/// re-evaluation was unreliable in combination with the Overview ListView's
33+
/// TwoWay SelectedItem binding — the pane would stay open after the close
34+
/// button cleared the selection. See issue #15.
35+
/// </summary>
36+
[ObservableProperty]
37+
public partial bool IsFindingDetailVisible { get; set; }
38+
39+
partial void OnSelectedFindingChanged(ManifestFinding? value)
40+
{
41+
IsFindingDetailVisible = value is not null;
42+
}
43+
2844
[ObservableProperty]
2945
public partial string AssessmentMessage { get; set; } = string.Empty;
3046

0 commit comments

Comments
 (0)