diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 968c0f1..f81c376 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.2.11")] -[assembly: AssemblyFileVersion("1.2.2.11")] +[assembly: AssemblyVersion("1.2.2.12")] +[assembly: AssemblyFileVersion("1.2.2.12")] diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index ff2e5a5..09b9649 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -779,10 +779,12 @@ namespace SystemTrayMenu.UserInterface like = $"LIKE '%{searchString}%'"; } + bool isSearchStringEmpty = string.IsNullOrEmpty(searchString); + try { if (Properties.Settings.Default.ShowOnlyAsSearchResult && - string.IsNullOrEmpty(searchString)) + isSearchStringEmpty) { data.DefaultView.RowFilter = "[SortIndex] LIKE '%0%'"; } @@ -805,8 +807,7 @@ namespace SystemTrayMenu.UserInterface } string columnSortIndex = "SortIndex"; - - if (string.IsNullOrEmpty(searchString)) + if (isSearchStringEmpty) { foreach (DataRow row in data.Rows) { @@ -852,7 +853,7 @@ namespace SystemTrayMenu.UserInterface { RowData rowData = (RowData)row.Cells[2].Value; - if (!string.IsNullOrEmpty(searchString) || !rowData.ShowOnlyWhenSearch) + if (!isSearchStringEmpty || !rowData.ShowOnlyWhenSearch) { rowData.RowIndex = row.Index; @@ -880,6 +881,11 @@ namespace SystemTrayMenu.UserInterface { timerUpdateIcons.Start(); } + + if (isSearchStringEmpty) + { + dgv.FirstDisplayedScrollingRowIndex = 0; + } } private void PictureBox_MouseEnter(object sender, EventArgs e)