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
Post a Comment