2012-10-14 4 views
1

그리드 행의 하단에 정렬되도록 그리드의 같은 행에 두 가지 글꼴 스타일이 예상되지만 예상대로!글꼴 맞춤 해제

변경해야 할 사람이 있습니까?

건배,
베릴

문제

enter image description here

그리드

<Grid ShowGridLines="True"> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="Auto"/> 
     </Grid.RowDefinitions> 

     <Label Grid.Column="0" Grid.Row="0" Style="{StaticResource SubjectStyle}" .../> 
     ... 
     <TextBlock Grid.Column="2" Grid.Row="0" Style="{StaticResource DisplayNameStyle}" .../> 
     ... 
</Grid> 

주제 스타일

<Style x:Key="SubjectStyle" TargetType="{x:Type Label}"> 
    <Setter Property="FontWeight" Value="Bold" /> 
    <Setter Property="FontSize" Value="10" /> 
    <Setter Property="HorizontalAlignment" Value="Left" /> 
    <Setter Property="VerticalContentAlignment" Value="Bottom" /> 
    <Setter Property="VerticalAlignment" Value="Bottom" /> 
    <Setter Property="Width" Value="75" /> 
</Style> 

나 displayName 스타일

<Style x:Key="DisplayNameStyle" TargetType="{x:Type TextBlock}"> 
    <Setter Property="FontSize" Value="16" /> 
    <Setter Property="HorizontalAlignment" Value="Left" /> 
    <Setter Property="VerticalAlignment" Value="Bottom" /> 
    <Setter Property="MinWidth" Value="75" /> 
</Style> 

답변

2

TextBlock's 기본 Padding은 0 그냥 스타일의 Padding 속성에 대한 세터를 추가하는 기본 5.의 Padding있다.

1

은 크롬에서 런타임에 그것을 가져오고 F12는 요소를 검사 할 수 있습니다. 텍스트 블록에 영향을 미치지 않는 라벨에 영향을 미치는 여백 또는 기타 문제가있을 수 있습니다.

추가로 두 가지 모두에 대해 Label이 아닌 Label을 사용해야하는 이유는 무엇입니까?

최악의 경우, 서로 겹쳐서 여백이 없는지 확인하고 브라우저간에 확인하십시오. Label

+0

포스터는 WPF를 사용하므로 Chrome 디버그 도구가 적용되지 않습니다. 그러나 마진 스타일은 여전히 ​​비슷한 방식으로 적용됩니다. – meklarian

+0

원래는 레이블을 사용하여 액세스 텍스트를보다 쉽게 ​​읽을 수있게되었습니다. 건배 – Berryl