From 50a89ee5282c3db7bc5727d666f10bc840e8ddcb Mon Sep 17 00:00:00 2001 From: Roger Zander Date: Wed, 22 Jan 2020 13:13:05 +0100 Subject: [PATCH] New: jump the pressed character https://github.com/rzander/sccmclictr/issues/146 --- .../Controls/InstalledSoftwareGrid.xaml | 2 +- .../Controls/InstalledSoftwareGrid.xaml.cs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml b/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml index e6d6369..e705976 100644 --- a/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml +++ b/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml @@ -23,7 +23,7 @@ - + diff --git a/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml.cs b/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml.cs index af5cc81..b04da51 100644 --- a/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml.cs +++ b/SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml.cs @@ -132,6 +132,25 @@ private void ContextMenu_Opened(object sender, RoutedEventArgs e) } } } + + private void dataGrid1_KeyDown(object sender, KeyEventArgs e) + { + DataGrid dataGrid = sender as DataGrid; + if (dataGrid.Items.Count == 0 || e.Key < Key.A || e.Key > Key.Z) + { + return; + } + + foreach(sccmclictr.automation.functions.inventory.AI_InstalledSoftwareCache oItem in dataGrid.Items) + { + if (oItem.ARPDisplayName.StartsWith(e.Key.ToString(), StringComparison.CurrentCultureIgnoreCase)) + { + dataGrid.SelectedItem = oItem; + dataGrid.ScrollIntoView(dataGrid.SelectedItem); + return; + } + } + } } public class SWListConverter : IValueConverter