Shared styling in WPF -


I believe this can be done very easily, but I am a simple newbie, so bare with me .

What if I want to create all the TextBlock elements of UserControl, or UserControl, then FontWeight = "bold" and TextAlignment = "Right"? Is there some style that I can set for a TextBlock element within a certain radius, so I do not have to repeat all those properties?

If you keep it in your resources, then all your textboxes are the same.

  style target type = "{x: type text block}" & gt; & Lt; Setter property = "fontwhite" value = "bold" /> & Lt; Setter Property = "Textilement" Value = "Right" /> & Lt; / Style & gt;   

Alternatively, you can also sub-class from TextBlock (say, BoldTextBlock ) and use it as the target type As can. This is because you can use regular text blocks in the same control as special text blocks

  & gt; Style TargetType = "{x: Type BoldTextBlock}" & gt; & Lt; Setter property = "fontwhite" value = "bold" /> & Lt; Setter Property = "Textilement" Value = "Right" /> & Lt; / Style & gt;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -