question

ApptacularApps-8305 avatar image
0 Votes"
ApptacularApps-8305 asked ·

How to ignore case when using TextBox to filter listview

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); });
         }
windows-uwpwindows-uwp-xaml
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

mrlacey avatar image
0 Votes"
mrlacey answered ·

call .Contains(txtSearch.Text, StringComaprison.InvariantCultureIgnoreCase)

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.