I am just wondering if I can make several button templates in WPF then assign to a specific button the template to be used by ‘declaring’ the button template name (or other method you suggest)
The button templates I am trying to create are:
- Button with black background, rounded corners, text display
- Button with silver background, rounded corners, text display with an image beside the text
- Button with gold background, text display with a different image beside the text
The style of the button I will generate depends on what button template I will ‘call’
wherein:
If selection = 1, template 1 will be used. (this will be done in C#)
you can make as many button (or any other control) templates as you want to. you use the x:key=”” attribute on the style to “name” your template, and to set the style on the destired button….
and then on your button….
use a Dynamic Resource..
or you can use a StaticResource instead