Exemple #1
0
        private void TextBoxFilter_TextChanged(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;
            Plugin  plugin  = _currentListView.Tag as Plugin;

            if (!textBox.Visible)
            {
                return;
            }

            // Call FindItemWithText with the contents of the textbox.
            //ListViewItem foundItem = _currentListView.FindItemWithText(textBox.Text, false, 0, true);

            int          index     = _currentListView.FocusedItem.Index;
            ListViewItem foundItem = _currentListView.FindItemWithTextEx(textBox.Text, index, new[] { '[' });

            if (foundItem != null)
            {
                foreach (ListViewItem listViewItem in _currentListView.Items)
                {
                    if (listViewItem == foundItem)
                    {
                        listViewItem.Selected = true;
                        listViewItem.Focused  = true;
                        listViewItem.EnsureVisible();
                    }
                    else
                    {
                        listViewItem.Selected = false;
                    }
                }
            }
        }