c# - WPF: Button which is a path -


I have a bunch of buttons s in my code that looks almost the same. The only difference path between them is the data they use.

This is the style for my app's "least button":

  & lt; Style x: key = "minimize button" targetType = "{x: type button}" & gt; & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "{x: type button}" & gt; & Lt ;! - The limit here is to make the entire "block" clickable, without it, only the actual path is clickable. - & gt; & Lt; Border background = "transparent" & gt; & Lt; Path name = "The path" data = "{StaticResource MinimizeIconPath}" style = "{StaticResource WindowButtonPath}" /> & Lt; / Border & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt;  

As you can see, I'm basically just changing the control template to use the path instead of the default button content. But this announcement only for at least the button & ndash; I have some other buttons, such as "max", "restoration" and "near" to deal with. The problem is that the styles of those buttons should be identical , their path s

's data attribute should be different. >

Would you recommend me to use as little code as possible?

User control?


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -