2013-12-15 131 views
0

我使用grid view control的顯示數據,如何包裝在GridView的文本 - Windows應用商店的應用程序

問題是,我的一些文字很長,而且不翹曲correctlly

enter image description here

XAML是這樣的:

<GridView x:Name="itemGridView" Grid.Row="2" Margin="30,20,0,0" AutomationProperties.AutomationId="ItemsGridView" AutomationProperties.Name="Items" TabIndex="1" Grid.RowSpan="2" ItemsSource="{Binding EquipBookingCollection}" ItemTemplate="{StaticResource Standard250x250ItemTemplate}" SelectionMode="None" IsSwipeEnabled="false" IsItemClickEnabled="True" ItemClick="ItemView_ItemClick"/> 

和ItemTemplate中是這樣的:

<DataTemplate x:Key="Standard250x250ItemTemplate"> 
     <Grid HorizontalAlignment="Left"> 
      <StackPanel Margin="5"> 
       <StackPanel Orientation="Horizontal" Margin="3,0"> 
        <TextBlock Text="Start Time : " Style="{StaticResource TitleTextStyle}"></TextBlock> 
        <TextBlock Text="{Binding BookedFromDteTme }" TextWrapping="Wrap" Style="{StaticResource SubtitleTextStyle}" Margin="4,0,0,0"/> 
       </StackPanel> 

       <StackPanel Orientation="Horizontal" Margin="3,0"> 
        <TextBlock Text="Finish Time: " Style="{StaticResource TitleTextStyle}" ></TextBlock> 
        <TextBlock Text="{Binding BookedToDteTme }" TextWrapping="Wrap" Style="{StaticResource SubtitleTextStyle}" Margin="4,0,0,0"/> 
       </StackPanel> 

       <StackPanel Orientation="Horizontal" Margin="3,0"> 
        <TextBlock Text="Task Address : " Style="{StaticResource TitleTextStyle}" ></TextBlock> 
        <TextBlock Text="{Binding TaskAddress}" TextWrapping="Wrap" Style="{StaticResource SubtitleTextStyle}" Margin="4,0,0,0"/> 
       </StackPanel> 

       <StackPanel Orientation="Horizontal" Margin="3,0"> 
        <TextBlock Text="Task Description : " Style="{StaticResource TitleTextStyle}" ></TextBlock> 
        <TextBlock Text="{Binding TaskDescription}" TextWrapping="Wrap" Style="{StaticResource SubtitleTextStyle}" Margin="4,0,0,0"/> 
       </StackPanel> 

       <StackPanel Orientation="Horizontal" Margin="3,0"> 
        <TextBlock Text="Client Company : " Style="{StaticResource TitleTextStyle}" ></TextBlock> 
        <TextBlock Text="{Binding ClientCompany}" TextWrapping="Wrap" Style="{StaticResource SubtitleTextStyle}" Margin="4,0,0,0"/> 
       </StackPanel> 

       <StackPanel Orientation="Horizontal" Margin="3,0"> 
        <TextBlock Text="Status Name : " Style="{StaticResource TitleTextStyle}" ></TextBlock> 
        <TextBlock Text="{Binding Status.Description}" TextWrapping="Wrap" Style="{StaticResource SubtitleTextStyle}" Margin="4,0,0,0" Foreground="Red"/> 
       </StackPanel> 

      </StackPanel> 
     </Grid> 
    </DataTemplate> 

請幫助我,謝謝

+0

你想說明去下一行,爲多? – n00b

回答

0

設置文本塊

<TextBlock Text="{Binding BookedFromDteTme }" TextWrapping="Wrap" Style="{StaticResource SubtitleTextStyle}" Margin="4,0,0,0" Width = "200"/> 
0

的寬度屬性,而不是StackPanel中,你可以使用WrapPanel

 </WrapPanel> 
相關問題