No Default Content Property

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
boonec6
Posts: 6
Joined: Thu Dec 10, 2015 8:38 am

No Default Content Property

Postby boonec6 » Thu Dec 10, 2015 8:45 am

Hi, I'm just trying to get started with a pretty basic page. So far all I'm trying to do is create a 2 column grid, containing TextBlocks in the first column, and TextBoxes in the second column. It renders as expected in the preview pane, but when I try to Debug, I receive the error:

Code: Select all

Error   1   C#/XAML for HTML5: XamlPreprocessor (pass 1) failed: No default content property exists for element: TextBlock


I'm sure this is an extremely simple solution, but I'm struggling to get over this hurdle at the moment.

JS-Support @Userware
Site Admin
Posts: 1080
Joined: Tue Apr 08, 2014 3:42 pm

Re: No Default Content Property

Postby JS-Support @Userware » Thu Dec 10, 2015 8:48 am

Hi boonec6 and welcome to the forums.

Can you please post the piece of XAML code?

Thank you.
Regards,
JS-Support

boonec6
Posts: 6
Joined: Thu Dec 10, 2015 8:38 am

Re: No Default Content Property

Postby boonec6 » Thu Dec 10, 2015 8:50 am

Thanks for the quick response!

Code: Select all

<Page
    x:Class="JobProfitAnalyzer.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:JobProfitAnalyzer"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Page.Resources>
        <Style TargetType="TextBlock" x:Key="TextBlockStyle">
            <Setter Property="Foreground" Value="Red"/>
        </Style>
    </Page.Resources>
    <Canvas Background="Black">
        <StackPanel Orientation="Vertical">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100"/>
                    <ColumnDefinition Width="100"/>
                </Grid.ColumnDefinitions>
                <TextBlock x:Name="DayRateBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="0"><Bold>Day Rate:</Bold></TextBlock>
                <TextBox x:Name="DayRate" Foreground="Silver" Background="Black" Text="0" Width="100" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock x:Name="CoachRateBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="1"><Bold>Coach Rate:</Bold></TextBlock>
                <TextBox x:Name="CoachRate" Foreground="Silver" Background="Black" Text="0" Width="100" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock x:Name="DaysBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="2"><Bold>Days:</Bold></TextBlock>
                <TextBox x:Name="Days" Foreground="Silver" Background="Black" Text="0" Width="100" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock x:Name="NBTravelDaysBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="3"><Bold>NB Travel Days:</Bold></TextBlock>
                <TextBox x:Name="NBTravelDays" Foreground="Silver" Background="Black" Text="0" Width="100" Grid.Column="1" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock x:Name="DomIntBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="4"><Bold>International:</Bold></TextBlock>
                <TextBox x:Name="DomInt" Foreground="Silver" Background="Black" Text="0" Width="100" Grid.Column="1" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock x:Name="NBPrepDaysBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="5"><Bold>NB Prep Days:</Bold></TextBlock>
                <TextBox x:Name="NBPrepDays" Foreground="Silver" Background="Black" Text="0" Width="100" Grid.Column="1" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <TextBlock x:Name="OtherExpBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="6"><Bold>Other Expenses:</Bold></TextBlock>
                <TextBox x:Name="OtherExp" Foreground="Silver" Background="Black" Text="0" Width="100" Grid.Column="1" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            </Grid>
        </StackPanel>
        <StackPanel>
           
        </StackPanel>
    </Canvas>
</Page>

JS-Support @Userware
Site Admin
Posts: 1080
Joined: Tue Apr 08, 2014 3:42 pm

Re: No Default Content Property

Postby JS-Support @Userware » Thu Dec 10, 2015 8:55 am

The issue is due to the fact that in the current version a TextBlock can only contain plain text in the form of Text="..." attribute.

Please change the code so that the TextBlock uses this attribute.

For example, please replace the following code:

Code: Select all

<TextBlock x:Name="DayRateBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="0"><Bold>Day Rate:</Bold></TextBlock>

with:

Code: Select all

<TextBlock x:Name="DayRateBlock" VerticalAlignment="Center" Foreground="Silver" Grid.Column="0" Grid.Row="0" Text="Day Rate:" FontWeight="Bold"/>


Regards,
JS-Support

boonec6
Posts: 6
Joined: Thu Dec 10, 2015 8:38 am

Re: No Default Content Property

Postby boonec6 » Thu Dec 10, 2015 9:05 am

Simple enough! Thank you. Hopefully I can finish out this test run. I'm loving the product so far. :D

JS-Support @Userware
Site Admin
Posts: 1080
Joined: Tue Apr 08, 2014 3:42 pm

Re: No Default Content Property

Postby JS-Support @Userware » Thu Dec 10, 2015 10:36 am

Thanks! Glad it helped.

If it is not confidential, please be sure to post a link to your app in the "general discussions" forum when it's done :-) We cannot wait to see what people do with the product :-)

Regards,
JS-Support


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 2 guests

 

 

cron