I have the following items in a class, where strings bind properly to a TextBlock:
/// <summary>
/// Total lessons that where in the batch
/// </summary>
public int LessonsInBatch = 0;
/// <summary>
/// Total lessons that are left in the batch
/// </summary>
public int LessonsInBatchLeft => _lessonsBatch?.Count ?? 0;
I tried all of the following but nont works, and the StringFormat is always empty (eg. "bla foo {0}' is always ''):
<TextBlock HorizontalAlignment = "Right" VerticalAlignment = "Center"
Grid.Column = "1" Grid.Row = "0"
Margin = "10, 0, 0, 0" FontWeight = "Bold"
FontSize = "12" FontFamily = "Arial Black">
<Run Text="{Binding LessonsInBatchLeft}, StringFormat=' {0}'}"/>
<Run Text=" of "/>
<Run Text="{Binding LessonsInBatch}, StringFormat=' {0:N}'}"/>
</TextBlock>
or
<TextBlock HorizontalAlignment = "Right" VerticalAlignment = "Center"
Grid.Column = "1" Grid.Row = "0"
Margin = "10, 0, 0, 0" FontWeight = "Bold"
FontSize = "12" FontFamily = "Arial Black">
<Run Text="{Binding LessonsInBatchLeft}"/>
<Run Text=" of "/>
<Run Text="{Binding LessonsInBatch}"/>
</TextBlock>
or
<TextBlock HorizontalAlignment = "Right" VerticalAlignment = "Center"
Grid.Column = "1" Grid.Row = "0"
Margin = "10, 0, 0, 0" FontWeight = "Bold"
FontSize = "12" FontFamily = "Arial Black">
<TextBlock.Text>
<MultiBinding StringFormat="{}}{0} of {1}">
<Binding Mode="OneWay" Path="LessonsInBatchLeft" />
<Binding Mode="OneWay" Path="LessonsInBatch" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
I really don't know what to try else.
Binding for strings work, just not for Integers...