user controls - Adding resource dictionaries to a usercontrol library in wpf -
i have created user control class library , used resourcedictionary file in it. now, want use usercontrol in wpf application, have add resourcedictionary file again in projet! if don't add it, brings resourcedictionary file, , show error on mergedictionaries block! missing something!?
resource dictionary is:
<controltemplate x:key="movethumbtemplate" targettype="{x:type s:movethumb}"> <rectangle fill="transparent" cursor="hand"/> </controltemplate> <style x:key="itemstyle" targettype="contentcontrol"> <setter property="width" value="{binding relativesource={relativesource findancestor,ancestortype={x:type canvas}},path=actualwidth}"/> <setter property="minheight" value="60"/> <setter property="height" value="60"/> <setter property="content" value="mytextbox"/> <setter property="template"> <setter.value> <controltemplate targettype="contentcontrol"> <grid datacontext="{binding relativesource={relativesource templatedparent}}"> <s:movethumb template="{dynamicresource movethumbtemplate}"/> <contentpresenter name="maincontrol" content="{templatebinding contentcontrol.content}" margin="5,0,10,0"/> <grid opacity="0" margin="-3"> <s:resizethumb height="3" cursor="sizens" verticalalignment="top" horizontalalignment="stretch"/> <s:resizethumb height="3" cursor="sizens" verticalalignment="bottom" horizontalalignment="stretch"/> </grid> </grid> </controltemplate> </setter.value> </setter> </style> </resourcedictionary>
adding user control:
<usercontrol.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="/resources/moveresizethumb.xaml"/> </resourcedictionary.mergeddictionaries> </resourcedictionary> </usercontrol.resources>
give try:
<usercontrol.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="pack://application:,,,/{yourassemblywhereresourcedictionaryislocated};component/resources/moveresizethumb.xaml" /> </resourcedictionary.mergeddictionaries> </resourcedictionary> </usercontrol.resources>
Comments
Post a Comment