Specifying a Button Content that has mix of text and a Binding path

Building on the other answers, this is a little more terse:

<Button Content="{Binding FirstName, StringFormat='Click here, {0}!'}" />

For most cases you can use StringFormat in the Bindings, like for a TextBlock

<TextBlock Text="{Binding ElementName=textBox,
                          Path=Text,
                          StringFormat='{}{0} - Added Text'}"/>

However, this has no effect on a ContentControl (which Button inherits from). Instead, you can use ContentStringFormat

<Button Content="{Binding ElementName=textBox,
                          Path=Text}"
        ContentStringFormat="{}{0} - Added Text"/>

Also, for

  • ContentControl you use ContentStringFormat
  • HeaderedContentControl you use HeaderStringFormat
  • ItemsControl you use ItemStringFormat

Something like this:

<Button>
   <Button.Content>
      <TextBlock Text="{Binding SomeBindingPath, StringFormat='Some text {0}'}"/>
   </Button.Content>
</Button>

OR

<Button>
   <Button.Content>
      <StackPanel Orientation="Horizontal">
         <TextBlock Text="Some Text"/>
         <TextBlock Text="{Binding SomeBindingPath}"/>
      </StackPanel>
   </Button.Content>
</Button>

Basically, you can put any content inside a button using the approach above.