Shared styling in WPF -
i believe can done quite easily, i'm naive novice, bare me.
what if wanted create textblock
elements in usercontrol, or section of usercontrol, have fontweight="bold"
, textalignment="right"
? there style can set textblock
elements within scope don't have repeat attributes?
if set in resources, textblocks become same.
<style targettype="{x:type textblock}"> <setter property="fontweight" value="bold"/> <setter property="textalignment" value="right"/> </style>
alternatively, can subclass textblock
(say, boldtextblock
) , utilize target type. can utilize regular textblocks in same command special textblocks
<style targettype="{x:type boldtextblock}"> <setter property="fontweight" value="bold"/> <setter property="textalignment" value="right"/> </style>
wpf styling
No comments:
Post a Comment