Page 1 of 1

[Unity] TextBlock vs Label Binding

Posted: 06 Nov 2014, 14:46
by zyzyx
Hi,
I have a quick question:

Why does this work:
<TextBlock Text="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}" />
and this does not? (no error but nothing is displayed)
<Label Content="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}" />

Re: [Unity] TextBlock vs Label Binding

Posted: 07 Nov 2014, 11:38
by sfernandez
It seems we have a problem on how ContentPresenter (from the Label template) converts the Content when it is not a String or a UIElement. We will fix it for a following release.

The TextBlock is working because the default Converter created by the binding correctly converts from float to string.

Re: [Unity] TextBlock vs Label Binding

Posted: 07 Nov 2014, 12:32
by zyzyx
Thanks! I will try using TextBlock wherever possible for the time beeing.