diff --git a/MSIXplainer/MainPage.xaml b/MSIXplainer/MainPage.xaml index de58ca5..3a0b7a7 100644 --- a/MSIXplainer/MainPage.xaml +++ b/MSIXplainer/MainPage.xaml @@ -356,7 +356,8 @@ - @@ -510,7 +511,7 @@ @@ -518,11 +519,13 @@ diff --git a/MSIXplainer/MainPage.xaml.cs b/MSIXplainer/MainPage.xaml.cs index a6c67bc..879ae5e 100644 --- a/MSIXplainer/MainPage.xaml.cs +++ b/MSIXplainer/MainPage.xaml.cs @@ -97,6 +97,8 @@ private async void NavView_ItemInvoked(NavigationView sender, NavigationViewItem switch (invoked.Tag) { case "apps": + ExitCompareMode(); + ExitSettingsMode(); await OpenAppsPaneAsync(); break; @@ -195,6 +197,20 @@ private void ViewFinding_Click(object sender, RoutedEventArgs e) ViewModel.SelectedFinding = finding; } + /// + /// 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. 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; + } + /// /// Copies a manifest property value to the clipboard. Wraps the clipboard /// call in try/catch so a transient clipboard failure never bubbles up as 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;