.net - Apply IDataErrorInfo validation errors to a control Errors inside a usercontrol child element -
i have usercontrol contains label , textbox. validate textbox entry inside viewmodel using idataerrorinfo interface. validation kicks in, error not shown on textbox inside usercontrol on usercontrol itself.
this usercontrol (the other dependency properties in base class ):
<cc:labelableinputcontrol> <grid x:name="layoutroot" > <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition width="*" /> </grid.columndefinitions> <label content="{binding path=labeltext, fallbackvalue=empty label}" grid.column="0" horizontalalignment="left" name="baselabel" verticalalignment="center" width="{binding path=labelwidth}"/> <textbox grid.column="1" x:name="basetextbox" text="{binding text" /> </grid> </cc:labelableinputcontrol>
this code behind:
public partial class labelabletextbox : labelableinputcontrol { [bindable(true)] public string text { { return (string)getvalue(textproperty); } set { setvalue(textproperty, value); } } public static readonly dependencyproperty textproperty = textbox.textproperty.addowner(typeof(labelabletextbox)); public labelabletextbox() { initializecomponent(); layoutroot.datacontext = this; } }
and how it's (supposed) used:
<cc:labelabletextbox labeltext="{x:static text:resources.label_username}" text="{binding username, mode=twoway, validatesondataerrors=true, notifyonvalidationerror=true}" />
my question is: how can "forward" validation error textbox? currently, validation errors shown this, , don't want whole usercontrol framed.
thank you!
have @ thread: validation error templates usercontrol
they solve using errortemplates , triggers.
Comments
Post a Comment