diff --git a/OsuHelper/Views/MainWindow.xaml b/OsuHelper/Views/MainWindow.xaml index 4cf8456..809064c 100644 --- a/OsuHelper/Views/MainWindow.xaml +++ b/OsuHelper/Views/MainWindow.xaml @@ -331,7 +331,7 @@ Placement="Left" PlacementTarget="{Binding ElementName=BeatmapListDataGrid}" PopupAnimation="Fade" - StaysOpen="False"> + StaysOpen="False" Closed="BeatmapInfoPopup_Closed" Opened="BeatmapInfoPopup_Opened"> diff --git a/OsuHelper/Views/MainWindow.xaml.cs b/OsuHelper/Views/MainWindow.xaml.cs index 08273ec..2da8d75 100644 --- a/OsuHelper/Views/MainWindow.xaml.cs +++ b/OsuHelper/Views/MainWindow.xaml.cs @@ -52,16 +52,10 @@ private void MainWindow_OnLocationChanged(object sender, EventArgs e) private void BeatmapListDataGrid_MouseLeftButtonUp(object sender, MouseEventArgs e) { - if (BeatmapListDataGrid.SelectedItem == null || - BeatmapListDataGrid.SelectedItem == _lastSelectedPopupRecommendation) - { - BeatmapInfoPopup.IsOpen = false; - _lastSelectedPopupRecommendation = null; - } - else + if (BeatmapListDataGrid.SelectedItem != null && + _lastSelectedPopupRecommendation != BeatmapListDataGrid.SelectedItem) { BeatmapInfoPopup.IsOpen = true; - _lastSelectedPopupRecommendation = BeatmapListDataGrid.SelectedItem; } } @@ -74,5 +68,15 @@ private void CalculatorExpectedAccuracySlider_OnPreviewMouseLeftButtonUp(object { ((Slider) sender).GetBindingExpression(RangeBase.ValueProperty)?.UpdateSource(); } + + private void BeatmapInfoPopup_Closed(object sender, EventArgs e) + { + _lastSelectedPopupRecommendation = null; + } + + private void BeatmapInfoPopup_Opened(object sender, EventArgs e) + { + _lastSelectedPopupRecommendation = BeatmapListDataGrid.SelectedItem; + } } } \ No newline at end of file