Page 1 of 1

Data Binding StringFormat

Posted: 26 May 2017, 17:14
by realesmedia
XAML:
<Label x:Name="label" Content="my_value"/>
<TextBlock Text="{Binding Content, ElementName=label, StringFormat={}value is: {0}}"/>
My WPF project displays text "value is" before value correctly.
Noesis project displays only value without StringFormat property.

Re: Data Binding StringFormat

Posted: 29 May 2017, 09:26
by realesmedia
Any suggestions?

Re: Data Binding StringFormat

Posted: 29 May 2017, 14:25
by sfernandez
Sorry, but there is a bug with StringFormat as explained here: viewtopic.php?f=3&t=1091
Meanwhile you have to use 2 TextBlocks to accomplish that:
<Label x:Name="label" Content="my_value"/>
<StackPanel Orientation="Horizontal">
  <TextBlock Text="value is: "/>
  <TextBlock Text="{Binding Content, ElementName=label"/>
</StackPanel>