From 2e4b95488864da15ed73b4f8ac3cf3887ff663ae Mon Sep 17 00:00:00 2001 From: Andrew Clinick <80841394+aclinick@users.noreply.github.com> Date: Thu, 4 Jun 2026 07:18:12 -0700 Subject: [PATCH] Fix #15 (round 2): bind finding-pane visibility to explicit bool 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> --- MSIXplainer/MainPage.xaml | 7 ++++--- MSIXplainer/MainPage.xaml.cs | 5 ++++- MSIXplainer/ViewModels/MainPageViewModel.cs | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/MSIXplainer/MainPage.xaml b/MSIXplainer/MainPage.xaml index f275cb2..3a0b7a7 100644 --- a/MSIXplainer/MainPage.xaml +++ b/MSIXplainer/MainPage.xaml @@ -511,7 +511,7 @@ @@ -519,12 +519,13 @@ diff --git a/MSIXplainer/MainPage.xaml.cs b/MSIXplainer/MainPage.xaml.cs index 00dfdee..879ae5e 100644 --- a/MSIXplainer/MainPage.xaml.cs +++ b/MSIXplainer/MainPage.xaml.cs @@ -200,12 +200,15 @@ private void ViewFinding_Click(object sender, RoutedEventArgs e) /// /// Closes the finding detail pane. Clears the OverviewFindingsList selection /// explicitly first so the TwoWay binding can't immediately re-push the old - /// selection back into ViewModel.SelectedFinding once we null it. + /// selection back into ViewModel.SelectedFinding once we null it. Then + /// explicitly toggles IsFindingDetailVisible so the pane collapses even if + /// the SelectedFinding PropertyChanged notification gets coalesced. /// private void OnCloseFindingClick(object sender, RoutedEventArgs e) { OverviewFindingsList.SelectedItem = null; ViewModel.SelectedFinding = null; + ViewModel.IsFindingDetailVisible = false; } /// diff --git a/MSIXplainer/ViewModels/MainPageViewModel.cs b/MSIXplainer/ViewModels/MainPageViewModel.cs index f5eb16a..49e30f6 100644 --- a/MSIXplainer/ViewModels/MainPageViewModel.cs +++ b/MSIXplainer/ViewModels/MainPageViewModel.cs @@ -25,6 +25,22 @@ public partial class MainPageViewModel : ObservableObject [ObservableProperty] public partial ManifestFinding? SelectedFinding { get; set; } + /// + /// Whether the right-side finding-detail pane should be visible. Tracked as a + /// distinct observable bool (rather than binding visibility to a + /// NullToCollapsed function on SelectedFinding) because the x:Bind function + /// re-evaluation was unreliable in combination with the Overview ListView's + /// TwoWay SelectedItem binding — the pane would stay open after the close + /// button cleared the selection. See issue #15. + /// + [ObservableProperty] + public partial bool IsFindingDetailVisible { get; set; } + + partial void OnSelectedFindingChanged(ManifestFinding? value) + { + IsFindingDetailVisible = value is not null; + } + [ObservableProperty] public partial string AssessmentMessage { get; set; } = string.Empty;