wcf ria services - Silverlight: Access element in DataForm EditTemplate by name -
how 1 access control in dataform's edittemplate code behind?
the following edittemplate applies:
<toolkit:dataform itemssource="{binding elementname=somedomaindatasource, path=data, mode=twoway}"> <toolkit:dataform.edittemplate> <datatemplate> <stackpanel> .... <sdk:datepicker displaydate="{binding duedate, mode=twoway}}" x:name="dpcustommaterialduedate"/> .... </stackpanel> </datatemplate> </toolkit:dataform.edittemplate> </toolkit:dataform> is possible access datepicker code-behind file using variable name dpcustommaterialduedate? intellisense seems unable find it.
also tried access in dataform's contentloaded event, no luck, i.e.
dataformprintorders.contentloaded += (sender, args) => { datepicker d = (datepicker) dataformprintorders.findnameincontent("dpcustommaterialduedate"); if (d != null) { d.displaydatestart = datetime.now.addmonths(-1); d.displaydateend = datetime.now.addmonths(12); } }; the variable d null.
if can't access control it's name in code behid, can use findcontrol function thread
Comments
Post a Comment