Skip to content

Commit

Permalink
New: jump the pressed character
Browse files Browse the repository at this point in the history
  • Loading branch information
rzander committed Jan 22, 2020
1 parent c7dd3a4 commit 50a89ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ToolBar>
</DockPanel>
<DockPanel DockPanel.Dock="Top" >
<DataGrid AutoGenerateColumns="False" HorizontalAlignment="Stretch" Name="dataGrid1" VerticalAlignment="Stretch" IsReadOnly="True">
<DataGrid AutoGenerateColumns="False" HorizontalAlignment="Stretch" Name="dataGrid1" VerticalAlignment="Stretch" IsReadOnly="True" KeyDown="dataGrid1_KeyDown">
<DataGrid.Columns>
<DataGridTextColumn Header="Product Name" Binding="{Binding Path=ProductName}" SortDirection="Ascending"/>
<DataGridTextColumn Header="Publisher" Binding="{Binding Path=Publisher}"/>
Expand Down
19 changes: 19 additions & 0 deletions SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/InstalledSoftwareGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 50a89ee

Please sign in to comment.