I have 2 fields that I'd like to format into a TextBlock, example: "{0} of {1} hours used".
Currently have:
<TextBlock Text="{Binding HoursEntered}" />
<TextBlock Text=" of " />
<TextBlock Text="{Binding EstimatedHours}" />
<TextBlock Text=" hours used " />
Was looking at StringFormat for a single field, however this appears to only be available for WPF, not Silverlight:
<TextBlock Text="{Binding Path=HoursEntered, StringFormat='{0} of XX hours used'}"/>
I thought to use MultiBinding but this is not available in Silverlight 3 either?
How can I do a format string with multiple bound fields in Silverlight 3 xaml?
you could put the text in a readonly string in your binding source
Public ReadOnly Property HoursUsedMessage() As String
Get
Return String.Format("{0} of {1} hours used", _hoursEntered, _estimatedHours)
End Get
End Property
just make sure you also raise property notification for this property in the HoursEntered and EstimatedHours setters