From f4188f2c7518b28c9bf2b0473ceb89313b59aeb0 Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 25 Jul 2021 06:07:12 +0300 Subject: [PATCH] Automatically select first item after filtering --- ShareX.HistoryLib/Forms/HistoryForm.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ShareX.HistoryLib/Forms/HistoryForm.cs b/ShareX.HistoryLib/Forms/HistoryForm.cs index 07fdad728..d4d5874a6 100644 --- a/ShareX.HistoryLib/Forms/HistoryForm.cs +++ b/ShareX.HistoryLib/Forms/HistoryForm.cs @@ -245,6 +245,11 @@ private void AddHistoryItems(HistoryItem[] historyItems) lvHistory.FillLastColumn(); lvHistory.Focus(); + if (lvHistory.Items.Count > 0) + { + lvHistory.Items[0].Selected = true; + } + Cursor = Cursors.Default; } @@ -323,8 +328,6 @@ private void HistoryForm_Shown(object sender, EventArgs e) if (lvHistory.Items.Count > 0) { - lvHistory.Items[0].Selected = true; - cbTypeFilterSelection.Items.Clear(); cbTypeFilterSelection.Items.AddRange(allHistoryItems.Select(x => x.Type).Distinct().Where(x => !string.IsNullOrEmpty(x)).ToArray());