silverlight - Getting dynamically generated textbox values MVVM -


i generate couple of textboxes added stackpanel listbox item source

now e.g. 8 boxes generate unique names, how retrieve values these objects?

this follow mvvm pattern can't directly call xaml need values of text boxes save them

you can create binding in code-behind:

for (int = 0; < 8; i++) {     // create , initialize textbox      textbox textbox = new textbox();      // bind text "someproperty" in view model     textbox.setbinding(textbox.textproperty, new binding("someproperty") { mode = bindingmode.twoway }) ; } 

you alternatively use itemscontrol itemtemplate displaying textbox , bound collection in view model. way control number of text boxes number of elements in collection.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -