2010-11-23 2 views
1

저는 SL 4 앱을 만들고 있습니다. UI는 세 가지 주요 부분으로 구성됩니다 : 상단 검색 막대, 하단 즐겨 찾기 막대 및 둘 사이의 페이지 내용. 페이지 내용이 사용 가능한 모든 공간을 차지하고 싶습니다. 지금은 수평으로 확장되지만 수직으로는 확장되지 않습니다. 내가 뭘 잘못하고 있는지 모르겠다. 다음은 XAML입니다.Silverlight :이 컨트롤이 사용 가능한 모든 공간을 차지하도록하려면 어떻게해야합니까?

<Grid x:Name="LayoutRoot" Background="BurlyWood"> 
    <Grid.RowDefinitions> 
     <RowDefinition /> 
     <RowDefinition /> 
     <RowDefinition /> 
    </Grid.RowDefinitions> 

    <my:TopSearchBar x:Name="topSearchBar" Grid.Row="0" Navigator="{Binding ElementName=navigationFrame}" HorizontalAlignment="Stretch" VerticalAlignment="Top" /> 

    <!-- I want this to take up all available space between the bottom and top elements --> 
    <navigation:Frame x:Name="navigationFrame" Source="/HomePage.xaml" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="BlueViolet" /> 

    <my:BottomFavoritesBar x:Name="bottomFavoritesBar" Grid.Row="2" Navigator="{Binding ElementName=navigationFrame}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" /> 

</Grid> 

내가 잘못 할 수 있습니까?

답변

4
<Grid.RowDefinitions> 
    <RowDefinition Height="Auto" /> 
    <RowDefinition Height="*" /> 
    <RowDefinition Height="Auto"/> 
</Grid.RowDefinitions> 
+0

'Height = "Auto"가 암시 적입니까? –

+0

자동은 암시 적이지만 중요한 부분은 "*"열입니다. 그것은 가능한 모든 공간을 차지하도록 알려줍니다. 이 옵션을 사용하지 않으면 모든 3 열이 자동으로 표시되어 내용에 필요한 최소값을 의미합니다. – Stephan

+0

흥미 롭습니다. 가운데에 대해 Height = "*"'를 지정하는 것은 다른 두 개에 대해 Height = "Auto"를 더한 것과 같을 것이라고 생각했습니다. –

1

문제점을 재현 할 수 없습니다. 나를 위해 그리드는 공간을 채우기 위해 세로로 확장되고 각 자식 컨트롤은 높이의 1/3을 차지합니다.

StackPanel과 같이 다른 모든 내부에이 격자가있어 모든 수직 공간을 채우지 못하도록합니까?

+0

StackPanel을 부모 컨트롤로 사용하면이 문제가 발생했습니다. 자식 Grid를 전체 크기로 확장 할 수없는 부모 xaml 파일에 StackPanel이 있습니다. 상위 StackPanel을 Grid로 변경하면 다른 답변이 권장하는대로 작동하기 시작했습니다. –

관련 문제