zyzyx
Topic Author
Posts: 19
Joined: 13 Aug 2014, 13:19

[Unity] TextBlock vs Label Binding

06 Nov 2014, 14:46

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}}}" />
 
User avatar
sfernandez
Site Admin
Posts: 3184
Joined: 22 Dec 2011, 19:20

Re: [Unity] TextBlock vs Label Binding

07 Nov 2014, 11:38

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.
 
zyzyx
Topic Author
Posts: 19
Joined: 13 Aug 2014, 13:19

Re: [Unity] TextBlock vs Label Binding

07 Nov 2014, 12:32

Thanks! I will try using TextBlock wherever possible for the time beeing.

Who is online

Users browsing this forum: No registered users and 3 guests