Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Crash when XAML doesn't use Label.Text tag

$
0
0

Hi all:

I've been going through Charles Petzold's excellent Xamarin.Forms book preview, and I ran into a situation where his code crashes.

I don't think this is his problem -- I think it's something else, which is why I'm mentioning it here instead of contacting him.

In Chapter 7, his TextVariations project crashes for me on startup, with this error:

"Could not load type Xamarin.Forms.Platform._LabelRenderer, Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null while decoding custom attribute"

By process of elimination, I determined that the lack of <Label.Text> tags is the cause -- the 3rd label in the code below:

<ScrollView>
    <StackLayout>

        <Label VerticalOptions="CenterAndExpand" Text="Single lines of text are easy." />

        <Label VerticalOptions="CenterAndExpand">
            <Label.Text>
                Text can also be content of the Text property.
            </Label.Text>
        </Label>

        <Label VerticalOptions="CenterAndExpand">
            Text is the content property of Label.
        </Label>

    </StackLayout>
</ScrollView>

This shouldn't be the case. Pressing command-D on a "Label" variable shows this:

[ContentProperty("Text"), RenderWith(typeof(_LabelRenderer))]
public class Label : View, IFontElement {
    . . .

It is clearly defined with ContentProperty of "Text", so eliminating the <Label.Text> tag ought to be fine. So I don't know what the problem is. Has anyone else run into this?

Thanks!

P.S. - I upgraded to the latest stable versions of Xamarin:

Xamarin Studio Version 5.9.4 (build 5)
Xamarin.Android Version: 5.1.4.16
Xamarin.iOS Version: 8.10.3.2


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>