Added Control-F Search

This commit is contained in:
2023-02-25 15:45:37 +01:00
parent e8c28e7594
commit 6583f1c791
2 changed files with 19 additions and 7 deletions

View File

@ -26,6 +26,7 @@ namespace WGneu.Windows
private bool isEditing = false;
private bool isCreating = false;
private List<string> textFilter = new();
private static RoutedCommand controlF = new RoutedCommand();
private readonly WgContext context = new();
public MemberListWindow()
@ -38,6 +39,8 @@ namespace WGneu.Windows
RefreshMemberList();
BranchInput.ItemsSource = context.Branches.OrderBy(b => b.Name).ToList();
DefaultKgInput.ItemsSource = context.WbKgs.Select(k => k.Kg).OrderBy(k => k.Name).ToList();
controlF.InputGestures.Add(new KeyGesture(Key.F, ModifierKeys.Control));
CommandBindings.Add(new CommandBinding(controlF, FocusSearchInput));
}
protected override void OnClosing(CancelEventArgs e)
@ -233,6 +236,15 @@ namespace WGneu.Windows
RefreshMemberList();
}
private void FocusSearchInput(object sender, RoutedEventArgs e)
{
if (!isEditing)
{
SearchInput.Focus();
SearchInput.SelectAll();
}
}
private int NextMgNr()
{
int c = context.Members.Select(m => m.MgNr).Min();