2013-06-17 2 views
1

TextBlock.VerticalAlignment = Top, Padding = 0 일 때조차도 오름차순 라인 위쪽에 TextBlock 위쪽에 공백이 있음을 알았습니다 (빨간색 화살표가 그림에 표시됨). TextBlock.Height = Auto입니다. 다른 공간이있는 이유를 아는 사람이 있습니까? TextBlock.Height 및 TextBlock.Margin의 절대 값을 지정하지 않고이를 제거 할 수있는 방법이 있습니까?TextBlock의 글꼴 오름차순 라인 위의 공백 공간

<phone:PhoneApplicationPage 
x:Class="PhoneApp1.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" 
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 Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/> 
     <TextBlock 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" ShowGridLines="True"> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="Auto" /> 
      <ColumnDefinition Width="Auto" /> 
      <ColumnDefinition Width="*" /> 
     </Grid.ColumnDefinitions> 

     <TextBlock Height="Auto" FontWeight="Light" Text="aps" FontSize="100" Grid.Column="0" VerticalAlignment="Top" Padding="0" /> 
     <TextBlock Height="Auto" FontWeight="Light" Text="Sphinx" FontSize="100" Grid.Column="1" VerticalAlignment="Top" Padding="0" /> 
    </Grid> 
</Grid> 

+0

스크린 샷 : http://i.stack.imgur.com/LAk95.jpg – codewarrior

답변

0

공간이 라인 간격의 결과이다 : 여기

는 XAML 코드이다.

<TextBlock LineHeight="80" LineStackingStrategy="BlockLineHeight" 

그러나, 당신은은 lineHeight 직접 계산해야하고 그것은 글꼴과 크기 사이에 글꼴에 따라 다르지만, 그것은 정확한에 텍스트를 배치하는 가장 쉬운 방법 : 하나의 해결책은 TextBlock의 추가 속성을 설정 할 수 있습니다 원하는 라인. 이것이 받아 들일 수 없다면, 이제는 문제의 근원을 알게되었으므로보다 일반적인 해결책을 찾을 수 있습니다.

관련 문제