xaml - How to set TargetType to this in WPF? -
i have custom usercontrol
(e.g. called myusercontrol) several child controls. create usercontrol.resources
set of styles , dependency properties assignments design purposes (without styles control looks ball of mud). later comment styles.
the problem is, don't know how set targettype
of style in order point out usercontrol
being developed.
here example how like:
<usercontrol.resources> <style targettype="this"> </style> </usercontrol.resources>
you can this:
<usercontrol x:class="yourprojectname.usercontrol1" xmlns:local="clr-namespace:yourprojectname" <usercontrol.resources> <style targettype="{x:type local:usercontrol1}"> <setter property="background" value="green"></setter> </style> </usercontrol.resources> </usercontrol>
Comments
Post a Comment