properties - Silverlight: How do i assign a usercontrol's property value to a textbox? -
i have user control have added outer form in silverlight. user control has textbox called txtroletitle, have declared property in usercontrol's class called lablename , assigned txtroletitle.text labelname shown in code below bellow, in silverlight property panel, under miscellaneous menu, have set labelname "landlord", added 1 of user control outerform , set labelname tenant. not seem work when run silverlight dialogue. value of labelname not appear in textbox during design , run time.
here code below. thanks
public partial class userroledetails : usercontrol { public string labelname { get; set; } public userroledetails() { initializecomponent(); this.txtroletitle.text = labelname; }
}
you setting value of txtroletitle.text in constructor, @ point of assignment labelname property not have value.
i think need @ making labelname dependency property , binding txtroletitle control in user control's xaml. take @ example : http://stevenhollidge.blogspot.co.uk/2012/03/dependency-properties-in-user-control.html
Comments
Post a Comment