I am trying out new styles with silverlight, and I created a new button skin with blend that consists of a border and a textblock. Wondered if there is a way to change the the text of the textblock when the the button's content(text) property is changed.
A:
I don't really get what your trying to do. Normally, you include a TextBlock like that as a part of the button content.
mdm20
2009-05-12 16:32:45
Button content as in the button text.
Drahcir
2009-05-12 16:36:54
+1
A:
The binding would look like this:
<TextBlock Text="{TemplateBinding Content}"/>
The problem is when I try to set the content to something other than text:
<Button>
<Button.Content>
<Rectangle Fill="#FFB51111"/>
</Button.Content>
</Button>
In this case using the ContentPresenter would work better. It uses the same binding expression, but can display more than text. But all that is really up to you.
McAravey
2009-05-12 17:42:55
A:
Use a ContentPresenter rather than a TextBlock in your Template.
Gordon Mackie JoanMiro
2009-05-13 13:41:41