2013-06-11 82 views
0

我在那有3行的網格一個ItemsControl使用一個DataTemplate之間空TextBlock的行爲:差異RowDefinition高度=「自動」與WP7與WP8

  <Grid Margin="12,0,0,4"> 
       <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="80" /> 
        <ColumnDefinition Width="330" /> 
        <ColumnDefinition Width="30"/> 
       </Grid.ColumnDefinitions> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="Auto" /> 
        <RowDefinition Height="Auto" /> 
        <RowDefinition Height="Auto" /> 
       </Grid.RowDefinitions> 
       <TextBlock Text="{Binding Due}" 
          Foreground="CornflowerBlue" 
          FontSize="28" 
          HorizontalAlignment="Center" /> 
       <TextBlock Text="{Binding Expected.Value}" 
          Foreground="Red" 
          FontSize="16" 
          Grid.Row="1" 
          Grid.RowSpan="2" 
          HorizontalAlignment="Center" /> 
       <TextBlock Text="{Binding Destination}" 
          Grid.Column="1" 
          FontSize="28" 
          TextWrapping="Wrap" 
          HorizontalAlignment="Left" /> 
       <TextBlock Text="{Binding Via}" 
          Grid.Column="1" 
          Grid.Row="1" 
          Foreground="Gray" 
          FontSize="16" 
          HorizontalAlignment="Left" /> 
       <TextBlock Text="{Binding Status}" 
          Grid.Column="1" 
          Grid.Row="2" 
          FontSize="16" 
          HorizontalAlignment="Left" /> 
       <TextBlock Text="{Binding Platform.Value}" 
          Grid.Column="2" 
          Grid.RowSpan="3" 
          FontSize="40" 
          VerticalAlignment="Top" 
          HorizontalAlignment="Center" /> 
      </Grid> 

在一些項目中,通過綁定將有一個空字符串,並在WP7導致中間行崩潰。但是,當我將項目轉換爲WP8時,行爲不同,我得到一個空行,就好像它爲textblox保留空間,即使它沒有文本。

在這種情況下,我如何強制WP8具有與WP7相同的行爲?

回答