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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -