wpf - Retemplating a Button control with custom properties possible? -


I have created myself a TransparentButton style which can be found in the button The way I treat it, the way I want it (mouseover, enable, etc.), but whatever I am not able to do is set correctly in style. Currently, I manually & lt; Button> Content & gt; I set everything for every button in , and obviously the stuff needs to go in style I get a ContentTemplate with a StackPanel < / Code>, which has just one image and label . The problem is, I do not know my & lt; Button ... & gt; Markup is the text of the label and the image source I think was to do it with a template, but I am searching like crazy and looking for information. I'm unable.

So, in a nutshell, I want a consistent button style where the button content is just a a image and label a stackpanel , and I want to be able to make it in my GUI in a few simple ways:

  & gt; Button style = {DynamicResource TransparentButton} "label =" click me "image =" picture / MyImage.png "/>  

Any suggestion would be appreciated! I hope I Here's the right path ...

In order to create custom properties like this, you just have to Instead of using the button style, use custom controls.

It is quite easy, however - just create a custom control, which is a sub-class button, and your new asset It will make you stylish, but it will also give you the ability of the enfo. Please tell that those properties are always with the syntax, which you are describing ( & lt; button << Apart from changing the code: from local: MyButton ) are always available.

For details, see on MSDN.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -