views:

2017

answers:

2

I am having the following XAML code, which throws error following error pointing to line# 16.

the property 'Content' is set more than once

Any thoughts?

1       <Grid x:Name="LayoutRoot" Width="970" Height="460" Background="White">  
2        <Grid.RowDefinitions>  
3         <RowDefinition Height="*"/>
4         <RowDefinition Height="80"/>
5        </Grid.RowDefinitions>
6        <Border Margin="3" BorderBrush="#FF464646" BorderThickness="1" CornerRadius="5" Grid.Row="0">
7         <Border.Background>
8          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
9           <GradientStop Color="#FF5B5A5A" Offset="0.02"/>
10          <GradientStop Color="#FF3B3B3B" Offset="0.213"/>
11          <GradientStop Color="#FF535151" Offset="0.807"/>
12         </LinearGradientBrush>
13        </Border.Background>
14   
15               <Liquid:Viewer Content="Viewer">
16                   <Image Source="Images/planet.jpg" Opacity="0.8" Stretch="Fill" />
17               </Liquid:Viewer>
18   
19           </Border>
20       <Border Margin="3" BorderThickness="1" CornerRadius="5" Grid.Row="1">
21        <Border.Background>
+2  A: 

In line 15 you set the Content in the Attribute and in line 16 you have the Image as 2. content.

Mischa
+3  A: 

The Content property is normally mapped to whatever is between the and tags, e.g.

<Control>
    This stuff is set to the Content property
</Control>

But it can also be set like a normal property, e.g.

<Control Content="This stuff is set to the Content property" />

In you're example you're doing both by setting the Content property on line 15 like a normal property and again on line 16 between the tags. I'm guessing you will want to get rid of the Content="Viewer" on line 15 to get the output you are looking for.

Bryan Anderson