tags:

views:

25

answers:

2

I simply want a button with no background or anything other than plain text. I have done the following and the button does not show up at all:

<UserControl.Resources>
    <ControlTemplate x:Key="linkButtons" TargetType="Button">
        <TextBlock Foreground="White" FontSize="28" FontFamily="Verdana" Padding="10"></TextBlock>
    </ControlTemplate>
</UserControl.Resources>


<Button Template="{StaticResource linkButtons}" Content="Hello World!"/>
+3  A: 

This is because the TextBlock inside the Control template does not have a template binding. Make an attribute like this:

<TextBlock Foreground="White" FontSize="28" FontFamily="Verdana" Padding="10" Text="{TemplateBinding Content}" />

Not sure if thats the correct syntax, but thats the concept.

Shawn Mclean
that makes sense but you're right the syntax is off.. "Content" isn't an option
Matt
It is. Content is a property of Button. It won't show up in the intellisense, though.
MojoFilter
+1  A: 
Eric Mickelsen
I must not be doing something right.. it's not working for me
Matt
Provide an update with your latest code?
Eric Mickelsen