c# - Use DataTemplate from App.xaml -
in app.xaml have defined datatemplate datatype entry. in datatemplate i'm creating grid several rows , columns.
the xaml of datatemplate looks like:
<datatemplate x:key="entrytemplate" datatype="entity:entry" x:name="entrytemplate"> <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="*"/> <columndefinition width="*"/> </grid.columndefinitions> <grid.resources> <style targettype="hcbase:hcontrolbase" x:key="toprowmargin"> <setter property="margin" value="2,2,50,2"/> </style> </grid.resources> <hc:hcombobox grid.row="0" grid.column="0" header="entry-type:" style="{staticresource toprowmargin}" selectedindex="0" itemssource="{binding source={staticresource entrytypesdataprovider}}" selecteditem="{binding entrytype, updatesourcetrigger=propertychanged, mode=twoway}"/> </grid> </datatemplate> the template not finished yet.
now want use datatemplate in window, have entry-object in viewmodel. @ moment have no glue how use this.
what have display entry-object viewmodel in view using datatemplate?
personally create contentcontrol, example in mainwindow contenttemplate this:
<contentcontrol name="mycontent" contenttemplate="{staticresource entrytemplate}"> <entity:entry /> <!-- viewmodel here --> </contentcontrol>
Comments
Post a Comment