WPF filtering ListBox after ComboBox selected changes c# -
i have combobox binded 1 datatable(1 column "country") , listbox binded 1(2 columns "name", "country"). how make listbox filter on selected item in combo box changes?
for example:
combobox values: ger, pol, rus
datatable binded listbox:
name | country john | ger luke | pol sasha| rus cj | ger carl | pol
when choose ger in combobox want refresh listbox see only:
john
cj
i used filter datatable
dataset.tables["name"].defaultview.rowfilter = "country '%" + comboboxfilter.text + "%' ";
but have result delayed 1 click.
change | result ger | no change pol | see ger names rus | see pol names pol | see rus names
why delayed?
combobox.text delayed 1 event
to actuall selected value in selection change event code needed
datarowview drw = (datarowview)(sender combobox).selecteditem; string text = drw["type"].tostring() ;
Comments
Post a Comment