Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
Actually fixed the popup behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Aug 23, 2016
1 parent 0cd05e5 commit 0987841
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion OsuHelper/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
Placement="Left"
PlacementTarget="{Binding ElementName=BeatmapListDataGrid}"
PopupAnimation="Fade"
StaysOpen="False">
StaysOpen="False" Closed="BeatmapInfoPopup_Closed" Opened="BeatmapInfoPopup_Opened">
<materialDesign:Card HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
Expand Down
20 changes: 12 additions & 8 deletions OsuHelper/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand All @@ -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;
}
}
}

0 comments on commit 0987841

Please sign in to comment.