data binding - Accessing TextBoxes in WPF DataBound ListBox with foreach -



data binding - Accessing TextBoxes in WPF DataBound ListBox with foreach -

i have databound wpf listbox custom itemtemplate -> datatemplate. part of template listbox. on event i'd loop through textboxes in listbox , retreive values. possible?

you should able using itemcontainergenerator , finding elements in template:

foreach (var item in lb.items) { var itemcontainer = lb.itemcontainergenerator.containerfromitem(item) listboxitem; // name textbox in template find here. var textbox = itemcontainer.contenttemplate.findname("?????", itemcontainer) textbox; var value = textbox.text; }

(if textboxes referred within listbox in template have dig deeper repeating same method.)

wpf data-binding

Comments

Popular posts from this blog

python - How to add an model instance to a django queryset? -

Using Android Volley to post an array to PHP -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -