2012-04-15 2 views
1

내 xaml에서 화면의 나머지 부분을 어떻게 볼 수 있습니까? 높이 2000 픽셀의 텍스트 블록을 추가했는데 나머지는 어떻게 볼 수 있습니까? 그리고, 콘텐츠 섹션에 scrollviewer를 추가하면 텍스트 블록이 자동으로 왼쪽 상단으로 이동합니다. 그리고, 내 xaml에서 텍스트가 가운데에있는 것을 볼 수 있지만 괜찮아 보이지만 에뮬레이터 텍스트는 한 줄에 있습니다. 어떻게 수리해야합니까?나머지 화면을보고 더 많은 텍스트를 추가하는 방법

<phone:PhoneApplicationPage 
    x:Class="Excercises.Weider_s_six" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}" 
    SupportedOrientations="Portrait" Orientation="Portrait" 
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480" 
    shell:SystemTray.IsVisible="True"> 

    <!--LayoutRoot is the root grid where all page content is placed--> 
    <Grid x:Name="LayoutRoot" Background="#FF1FB0DB"> 
     <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="PageTitle" Text="Weider's six" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="64" /> 
     </StackPanel> 

     <!--ContentPanel - place additional content here--> 
     <ScrollViewer> 
     <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
       <TextBlock Height="2000" HorizontalAlignment="Left" Margin="0,6,0,0" Name="TextBlock1" Text="Weider 6 pack Training is a perfect exercise for flat stomach. 
    This easy training programme has many advantages. 
    It's perfect for beginners and for experts – exercises are easy and begin with the basic level, so every beginner can use them but they get more complicated pretty fast so advanced sportsmen can also be interested in them. 
    It helps not only carve your muscles but also burn fat – during the exercise you not only use your abdominal rectus but you also move your legs and arms. It is also because W6 puts pressure on the number of repetitions. It carves your muscles but also burns fat. You can train W6 for about 40 minutes without taking any breaks – you use up all glycogen in blood and start burning the fat. 
    It is easy – it is a really easy training set which you can train almost anywhere. All you need is flat ground. 
    It gives excellent results – if you want to have a flat stomach W6 is designed just for you. You can see the first effects after just a week and after a whole series it is really impressive. 
    How to do Weider 6 

    Starting Position 

    Lay flat on the ground, hands along the body. 
    1 – exercise 1 

    Lift your right leg and bend your knee to right angle angle 
    Lift your upper torso to contract abdominal muscles and hold the lifted knee with your hands. 
    Hold still for 3 seconds. 
    Return to the starting position. 
    Repeat the exercise with the other leg 
    2 – exercise 2 

    Lift both legs and bend your knees to right angle 
    Lift your upper torso to contract abdominal muscles and hold both knees 
    Hold still for 3 seconds 

    Return to the starting position" VerticalAlignment="Top" Width="450" /> 
     </Grid> 
     </ScrollViewer> 
    </Grid> 

    <!--Sample code showing usage of ApplicationBar--> 
    <!--<phone:PhoneApplicationPage.ApplicationBar> 
     <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> 
      <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/> 
      <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/> 
      <shell:ApplicationBar.MenuItems> 
       <shell:ApplicationBarMenuItem Text="MenuItem 1"/> 
       <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
      </shell:ApplicationBar.MenuItems> 
     </shell:ApplicationBar> 
    </phone:PhoneApplicationPage.ApplicationBar>--> 

</phone:PhoneApplicationPage> 
+0

코드를 붙여주세요. – innovia

+0

@Dawid - 제스처 및/또는 스크롤을 지원합니다. –

+0

스크롤 뷰어의 위치가 잘못되었습니다. 내보기를 보라. ScrollViewer는 주위를 둘러 보지 않고 콘텐츠 패널에 있어야합니다. – Robaticus

답변

3

하는 것은 주위, 당신이 ContentPanel의 그리드에있는 ScrollViewer 을 넣어해야합니다.

편집 : 당신은 당신의 코드를 변경해야하는 경우 여기

<!--ContentPanel - place additional content here--> 
    <ScrollViewer> 
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 

코드는해야한다 : 아래

<!--ContentPanel - place additional content here--> 
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
    <ScrollViewer> 

샘플 작동하는 방법을 보여줍니다

마 어쩌면 틀린 표에 scrollviewer가 있을까요? 방금이 시도하고, 그것은 스크롤 텍스트 블록을 제공합니다.

몇 가지 사항을 확인하십시오.

  • 귀하의 ScrollViewer는 일반적으로 "ContentPanel"이라는 그리드에 있어야합니다.
  • 오버플로 텍스트를 처리하는 방법을 지정해야합니다. 이 작업은 TextWrapping 속성을 통해 수행됩니다.
<phone:PhoneApplicationPage 
    x:Class="StackoWPF.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}" 
    FontSize="{StaticResource PhoneFontSizeNormal}" 
    Foreground="{StaticResource PhoneForegroundBrush}" 
    SupportedOrientations="Portrait" Orientation="Portrait" 
    shell:SystemTray.IsVisible="True"> 

    <!--LayoutRoot is the root grid where all page content is placed--> 
    <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="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/> 
      <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> 
     </StackPanel> 

     <!--ContentPanel - place additional content here--> 
     <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
      <ScrollViewer> 
       <TextBlock Height="2000" TextWrapping="Wrap"> 
        <TextBlock.Text> 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
         One two three four five six seven eight nine ten eleven 
        </TextBlock.Text> 
       </TextBlock> 
      </ScrollViewer> 
     </Grid> 
    </Grid> 

    <!--Sample code showing usage of ApplicationBar--> 
    <!--<phone:PhoneApplicationPage.ApplicationBar> 
     <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True"> 
      <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/> 
      <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/> 
      <shell:ApplicationBar.MenuItems> 
       <shell:ApplicationBarMenuItem Text="MenuItem 1"/> 
       <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
      </shell:ApplicationBar.MenuItems> 
     </shell:ApplicationBar> 
    </phone:PhoneApplicationPage.ApplicationBar>--> 

</phone:PhoneApplicationPage> 
+0

Scrollviewer가 contentpanel입니다. 내 텍스트가 바뀝니다. –

+0

ok, scrollviewer가 작동합니다.) 이제 화면의 나머지 부분을 어떻게 볼 수 있습니까? 그리고 텍스트에 대해서는 감싸졌고 속성으로 설정했지만 한 줄로되어 있습니다. –

0

Robaticus 이미 대부분의 대답했다. 그러나 필요하다고 생각되는 텍스트 블록에 줄 바꿈 및 서식을 지정하려면 this을 참조하십시오.

내가 대답 한 비슷한 질문을 게시했습니다.

관련 문제