Value of a textbox in silverlight + MVVM -



Value of a textbox in silverlight + MVVM -

i have xaml names customer.xaml this:

<grid x:name="customview" > <stackpanel x:name="custompanel" > <textbox x:name="customtext" /> </stackpanel> </grid

using mvvm have created icustomerviewmodel , customerviewmodel this:

public interface icustomerviewmodel { icommand saveclientcommand { get; } } public class customerviewmodel : icustomerviewmodel , inotifypropertychanged { ...... private void executesaveclient() { // }

my question how value of within function executesaveclient() save this?

you should declare string property in view model say:

public string customtext { get; set; }

assign datacontext of customview viewmodel int constructor, hope grid in usercontrol or window:

this.customview.datacontext = new customerviewmodel();

bind property:

<textbox x:name="customtext" text="{binding customtext}"/>

implement inotifypropertychanged, if twoway binding , notification required.

read more silverlight databinding here.

mvvm textbox

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -