Silverlight Button Style

I tried new styles with silverlight and I created a new button skin with a combination of border and text block. I wonder if there is a way to change the text of the text block when changing the content property of the button (text).

0


a source to share


3 answers


The binding will look like this:

<TextBlock Text="{TemplateBinding Content}"/>

      

The problem is when I am trying to set content to something other than text:



    <Button>
        <Button.Content>
            <Rectangle Fill="#FFB51111"/>
        </Button.Content>
    </Button>

      

In this case, using ContentPresenter will work better. It uses the same anchor expression, but can display more text. But it all really depends on you.

+1


a source


I really don't understand what you are trying to do. Typically, you include the TextBlock as part of the button content.



0


a source


Use ContentPresenter and not TextBlock in your template.

0


a source







All Articles