my control template and style:
<ControlTemplate TargetType="{x:Type Button}" x:Key="ImageButtonTemplate">
<Image Source="..//..//images//ok.png"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"/>
</ControlTemplate>
<Style TargetType="{x:Type Button}" x:Key="ImageButton">
<Setter Property="Template" Value="{StaticResource ImageButtonTemplate}"/>
</Style>
<Button Style="{StaticResource ImageButton}" />
the button isn’t visible …
what am i missing ?
EDIT :
tried defining panel with height and width , button image is still not visible ..
little help .
<ControlTemplate TargetType="{x:Type Button}" x:Key="ImageButtonTemplate">
<Grid>
<Image Source="..//images//ok.png" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" />
</Grid>
</ControlTemplate>
and aren’t i suppose to put a in there ?
what am i doing wrong ?
You are not setting the width and height. Depending on the type of container you’ll need it in order to be visible (if using stackpanel for example).
Here you have another related question that explains it.
WPF TriState Image Button
EDIT:
I create a new project and within the start window wrote:
Now it’s working. The button It’s visible and within the event handler is working also.
Event Handler: