Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StringFormat in GroupBox header binding doesn't seem to work

I'm trying to bind the header text of aGroupBox to a property and display it using StringFormat.

The first part works and it returns the text as expected. But I want the final text to be formatted. For example when I return cm I want it to be displayed as Foundation Height (cm), but the code below only shows cm.

<GroupBox Header="{Binding CurrentTargetUnit, 
    Converter={StaticResource QuantityToTextConverter},
    ConverterParameter={x:Static enumerations:Quantity.Length},
    StringFormat='Foundation Height ({0})'}">
</GroupBox>
like image 511
Vahid Avatar asked Jan 05 '23 17:01

Vahid


1 Answers

Try without quotes

....
StringFormat=Foundation Height ({0})}">

UPDATE

As you have used binding for header you should use HeaderStringFormatinstead.

....
HeaderStringFormat=Foundation Height ({0})}">

Read the documentation for more

like image 54
Hamlet Hakobyan Avatar answered Jan 10 '23 10:01

Hamlet Hakobyan