How to ignore case when using TextBox to filter listview

Apptacular Apps 386 Reputation points
2020-06-06T11:35:13.983+00:00

Is there way of modifying the TextChanged event for a TextBox to ignore the case that has been entered? Currently in my ListView (containing town names) with a TextBox I want to search for any town name I want without having to use capital letters.

        private void txtSearch_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtSearch.Text))
            {
                this.ListTowns.ItemsSource = this.listItemTowns;
            }
            this.ListTowns.ItemsSource = this.listTowns.Where((item) => { return item.TownTitle.Contains(txtSearch.Text); });
        }
Universal Windows Platform (UWP)
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful