c# - bind item's children control in ItemsControl wpf -
i binding itemscontrol list, in item template there control not binding current datasource, want bind datasource.
but stuck @ accessing control
my itemscontrol's datatemplate is--->
<itemscontrol x:name="itemrequesterlist" istabstop="false"> <itemscontrol.itemtemplate> <datatemplate x:name="itemreqtemplate"> <stackpanel margin="10,0,0,0"> <textblock text="{binding displayname}"></textblock> <textblock text="requested on"></textblock> <textblock text="{binding}"></textblock> //<---this control, // want bind datasource </stackpanel> </datatemplate>
so how can access control, lie in each item ?
you bind datacontext of control static resource, example:
<textblock text="{binding}" datacontext="{staticresource myothercontext}"></textblock>
see following:
silverlight - setting datacontext in xaml rather in constructor?
Comments
Post a Comment