mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 19:08:27 +01:00
Pushing missing changes
This commit is contained in:
41
MediaBrowser.UI.Controls/ExtendedScrollViewer.cs
Normal file
41
MediaBrowser.UI.Controls/ExtendedScrollViewer.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace MediaBrowser.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// This subclass solves the problem of ScrollViewers eating KeyDown for all arrow keys
|
||||
/// </summary>
|
||||
public class ExtendedScrollViewer : ScrollViewer
|
||||
{
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (e.Handled || e.OriginalSource == this)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't eat left/right if horizontal scrolling is disabled
|
||||
if (e.Key == Key.Left || e.Key == Key.Right)
|
||||
{
|
||||
if (HorizontalScrollBarVisibility == ScrollBarVisibility.Disabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't eat up/down if vertical scrolling is disabled
|
||||
if (e.Key == Key.Up || e.Key == Key.Down)
|
||||
{
|
||||
if (VerticalScrollBarVisibility == ScrollBarVisibility.Disabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Let the base class do it's thing
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user