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

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

ms access - C# - Using OleDbParameter on table name -