Skip to content

Commit

Permalink
[Manager] Fix minor issues with Collections UI (#74)
Browse files Browse the repository at this point in the history
* Fix issues with scrolling

* fix selecting mods w/ collections

* use unselectall to deselect
  • Loading branch information
Dyvinia authored May 24, 2022
1 parent 87a8825 commit 2092c5e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FrostyModManager/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@

<Expander x:Name="modsExpander" IsExpanded="False">
<Border BorderThickness="1" BorderBrush="#454545" Margin="16, 0, -97, 2">
<ListView x:Name="collectionModsList" ItemsSource="{Binding Path=Mods}" MouseDoubleClick="collectionModsList_MouseDoubleClick" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView x:Name="collectionModsList" ItemsSource="{Binding Path=Mods}" MouseDoubleClick="collectionModsList_MouseDoubleClick" ScrollViewer.HorizontalScrollBarVisibility="Disabled" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel" LostFocus="collectionModsList_LostFocus">
<ListView.View>
<GridView ScrollViewer.CanContentScroll="False">
<GridView.ColumnHeaderContainerStyle>
Expand Down
17 changes: 17 additions & 0 deletions FrostyModManager/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1762,5 +1762,22 @@ private void collectionModsList_MouseDoubleClick(object sender, MouseButtonEvent
// focus on tab item
appliedModsTabItem.IsSelected = true;
}

private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (sender is ListBox && !e.Handled)
{
e.Handled = true;
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
eventArg.RoutedEvent = UIElement.MouseWheelEvent;
eventArg.Source = sender;
var parent = ((Control)sender).Parent as UIElement;
parent.RaiseEvent(eventArg);
}
}

private void collectionModsList_LostFocus(object sender, RoutedEventArgs e) {
((ListView)sender).UnselectAll();
}
}
}

0 comments on commit 2092c5e

Please sign in to comment.