controltemplates

Creating an image+text button with a control template?

对着背影说爱祢 提交于 2019-11-27 04:06:35
I am tired of creating the same image+text button over and over again, and I would like to move the markup to a control template. Here is my problem: I need to provide template bindings to add the image and text to the templated button, and the Button control doesn't seem to have properties that I can bind to. My template looks like this so far (with '???' for the unknown template bindings): <ControlTemplate x:Key="ImageButtonTemplate" TargetType="{x:Type Button}"> <StackPanel Height="Auto" Orientation="Horizontal"> <Image Source="{TemplateBinding ???}" Width="24" Height="24" Stretch="Fill"/>

Creating an image+text button with a control template?

被刻印的时光 ゝ 提交于 2019-11-26 11:03:24
问题 I am tired of creating the same image+text button over and over again, and I would like to move the markup to a control template. Here is my problem: I need to provide template bindings to add the image and text to the templated button, and the Button control doesn\'t seem to have properties that I can bind to. My template looks like this so far (with \'???\' for the unknown template bindings): <ControlTemplate x:Key=\"ImageButtonTemplate\" TargetType=\"{x:Type Button}\"> <StackPanel Height=\