Binding to Static class property and StringFormat

MenuItem provides a HeaderStringFormat property that you should use:

<MenuItem Header="{Binding Source={x:Static Settings:Settings.CurrentServer}}"
          HeaderStringFormat="Connection: {0}" />

Actually, that property is part of HeaderedItemsControl, which MenuItem happens to extend.

The StringFormat property is just ignored.


I suffered a similar problem and got around it by utilising ContentControl and it's separate ContentStringFormat property:

<TextBlock Cursor="Help" Text="Hello World" >
    <TextBlock.ToolTip>
        <ContentControl Content="{Binding Path=SomeProperty, Source={x:Static local:SomeStaticClass}}" ContentStringFormat="Hello {0}" />
    </TextBlock.ToolTip>
</TextBlock>