the property content is set more than once

后端 未结 1 1482
隐瞒了意图╮
隐瞒了意图╮ 2021-01-03 21:15

I am getting the following error with my code shown below.

Error:

The property \'Content\' is set more than once

Code:

相关标签:
1条回答
  • 2021-01-03 22:01

    A PanoramaItem can only have one child control but you currently have a TextBlock and a ListBox. To fix this, simply add another parent control to hold the TextBlock and ListBox (such as a StackPanel or a Grid). For example:

    <controls:PanoramaItem Header="headlines">
       <grid>
            <TextBlock Text="{Binding Tones}" />
            <!--Double line list with image placeholder and text wrapping-->
            <ListBox Margin="0,0,-12,0" ItemsSource="{Binding Tones}">
                <ListBox.ItemTemplate>
                     <DataTemplate>
                         <StackPanel Orientation="Horizontal" Margin="0,0,0,17">
                             <!--Replace rectangle with image-->
                             <Image Source="{Binding ImageUrl}" Height="75" Width="100" Margin="12,10,9,0" VerticalAlignment="Top"/>
                             <!--<Rectangle Height="100" Width="100" Fill="#FFE5001b" Margin="12,0,9,0"/>-->
                             <StackPanel Width="311">
                                  <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}"/>
                                  <!--<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>-->
                             </StackPanel>
                         </StackPanel>
                      </DataTemplate>
                 </ListBox.ItemTemplate>
            </ListBox>               
       </grid> 
    </controls:PanoramaItem>
    
    0 讨论(0)
提交回复
热议问题