c# - How to compare WPF ListBox Items with a String? -


i've seen examples sorting , filtering using colllectionview none doing in comparative logical way.

example:

// button event send item lb1 lb2 private void baddproduct_click(object sender, routedeventargs e) {   if(lb2.items.contains("item"))   {    messagebox.show("this item there!");   }   //second example    if(lb2.items.startwith("item"))    {      messagebox.show("this item there!");    }  } 

the code works winforms. there approach wpf?

thank you!

this code work in .xaml.cs file well, 'code behind' has direct reference named, non-template wpf items.

if data sources little more dynamic, suggest using ienumerable collections bind itemsource to, , can perform filtering using linq.

(edit: fixed typo 'datasources' 'data sources')


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -