2012-04-13 15 views
0

エラーを取得しようとしていますが、 プロパティ 'Content'が複数回設定されています。 タグの間に2行のコードのいずれかを削除すると消えます。 それでどちらも個別に間違っているように見えませんが、どちらも一緒に問題を引き起こします。<Scrollviewer> xamlを使用しているときのエラー

<Grid x:Name="LayoutRoot" Background="Transparent"> 

    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 

    <!--TitlePanel contains the name of the application and page title--> 
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> 
     <TextBlock x:Name="ApplicationTitle" Text="New Trip" Style="{StaticResource PhoneTextNormalStyle}" Height="40" /> 
     <Button Content="Back" Height="71" Name="button1" Width="103" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" HorizontalAlignment="Right" Click="button1_Click" /> 
    </StackPanel> 

    <!--ContentPanel - place additional content here--> 
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
     <ScrollViewer> 
      <TextBlock Height="60" HorizontalAlignment="Left" Margin="65,12,0,0" Name="textBlock1" Text="Username" VerticalAlignment="Top" Width="169" /> 
      <TextBox Height="78" HorizontalAlignment="Left" Margin="60,60,0,0" Name="textBoxUsername" VerticalAlignment="Top" Width="274" /> 
     </ScrollViewer> 
    </Grid> 

</Grid> 

答えて

3

ScrollViewerのは1つのだけのコンテンツを持っているので、グリッド、DockPanelのような容器にScrollViewerの内部

 <ScrollViewer> 
     <StackPanel> 
      <TextBlock Height="60" HorizontalAlignment="Left" Margin="65,12,0,0" Name="textBlock1" Text="Username" VerticalAlignment="Top" Width="169" /> 
      <TextBox Height="78" HorizontalAlignment="Left" Margin="60,60,0,0" Name="textBoxUsername" VerticalAlignment="Top" Width="274" /> 
     </StackPanel> 
     </ScrollViewer> 
のStackPanelにコントロールをラップすることができ
0

などのStackPanelなど、他の容器内にご<TextBlock><TextBox>を置きます。

関連する問題