2014-10-23 7 views
0

부모 그리드의 같은 행에 두 개의 격자 컨트롤이 있습니다. 나는 두 StackPanels에있는 다양한 이미지의 상단에 걸쳐 진행 막대 (pgbWorkingTime)을 모두 볼 위에 그대로설정 격자 가시성 숨기기 다른 격자

<Grid x:Name="grdTimelinePlusControls" Grid.Row="1" Grid.ColumnSpan="3"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*" /> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="Auto" /> 
    </Grid.RowDefinitions> 
    <ProgressBar x:Name="pgbVideoTimeline" HorizontalAlignment="Stretch" Height="7" Background="{StaticResource SecondaryColour}" Foreground="Maroon" BorderThickness="0" Style="{StaticResource ExpandContractTimeline}" Grid.Row="1" MouseDown="pgbVideoTimeline_MouseDown" MouseMove="pgbVideoTimeline_MouseMove" MouseUp="pgbVideoTimeline_MouseUp" /> 
    <Grid x:Name="grdControls" Grid.Row="2" Background="{StaticResource BackgroundColour}" Height="40" Style="{StaticResource ExpandHideControls}"> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="*" /> 
      <ColumnDefinition Width="*" /> 
     </Grid.ColumnDefinitions> 
     <StackPanel x:Name="stpPlaybackControls" Orientation="Horizontal" HorizontalAlignment="Left" Grid.Column="0"> 
      <Image x:Name="btnPlayPause" Height="30" Margin="10,5,5,5" ToolTip="Play" Source="Resources/Images/UI/Play.png" MouseEnter="buttonHover_MouseEnter" MouseLeave="buttonHover_MouseLeave" MouseUp="btnPlayPause_MouseUp" /> 
      <Image x:Name="btnReplay" Height="30" Margin="5" ToolTip="Replay" Source="Resources/Images/UI/Replay.png" MouseEnter="buttonHover_MouseEnter" MouseLeave="buttonHover_MouseLeave" MouseUp="btnReplay_MouseUp" /> 
     </StackPanel> 
     <StackPanel x:Name="stpMiscControls" Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="1"> 
      <Slider x:Name="slrSpeed" Width="100" Margin="5,10,5,5" VerticalAlignment="Top" Minimum="1" Maximum="5" Value="3" LargeChange="1" IsSnapToTickEnabled="True" ValueChanged="slrSpeed_ValueChanged" /> 
      <Image x:Name="btnOpen" Height="30" Margin="5" ToolTip="Open" Source="Resources/Images/UI/Open.png" MouseEnter="buttonHover_MouseEnter" MouseLeave="buttonHover_MouseLeave" /> 
      <Image x:Name="btnFullScreen" Height="30" Margin="5" ToolTip="Fullscreen" Source="Resources/Images/UI/FullScreen.png" MouseEnter="buttonHover_MouseEnter" MouseLeave="buttonHover_MouseLeave" MouseUp="btnFullScreen_MouseUp" /> 
      <Image x:Name="btnSettings" Height="30" Margin="5,5,10,5" ToolTip="Settings" Source="Resources/Images/UI/Settings.png" MouseEnter="buttonHover_MouseEnter" MouseLeave="buttonHover_MouseLeave" /> 
     </StackPanel> 
    </Grid> 
</Grid> 
<Grid x:Name="grdWorkingTime" Grid.Row="1" Grid.ColumnSpan="3"> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="*" /> 
     <ColumnDefinition Width="Auto" /> 
    </Grid.ColumnDefinitions> 
    <ProgressBar x:Name="pgbWorkingTime" Background="{StaticResource BackgroundColour}" BorderBrush="{StaticResource ForegroundColour}" Width=500 Foreground="Maroon" Margin="5" /> 
</Grid> 

나는 한 번에와 코드 grdTimelinePlusControlsgrdWorkingTime 중 하나를 보여줄 예정. 내가 변경할 때 grdTimelinePlusControls의 여는 태그가되게합니다 : 그것은 표시되지 그리드 중 하나를 중지하고 나는 이유를 이해할 수 없다

<Grid x:Name="grdTimelinePlusControls" Grid.Row="1" Grid.ColumnSpan="3" Visibility="Collapsed"> 

. grdWorkingTime은 어쨌든 grdTimelinePlusControls의 자식이어야하지만 나는 그것을 볼 수 없으며, 문서 개요는 같은 수준으로 보여줍니다. 두 격자가 같은 부모 그리드의 행에 있는지 어떤 특별한 이유가 있나요

이것은 분명히 내 페이지에있는 모든 코드가 아니라 나는 ... 전체 페이지 here

답변

2

입니다 읽을 수를 유지하고 싶어 ? <RowDefinition Height="Auto" />과 함께 두 개의 행에 배치하면 '미사용'행은 동시에 표시하지 않으므로 해당 자식 그리드와 함께 축소됩니다. 작품과 좋은 점은 ... 난 아직도 원래 코드에서 이상하게 행동하는 이유를 알고 싶습니다 있지만

+0

네. – blawford

+0

@ blawford : 초기 가정은 당신과 정확히 같았을 것이고 나는 다른 그리드가 나타날 것으로 기대합니다. 상단 그리드를 접을 때 공간이 유지되거나 전체 행이 실제로 축소됩니까? – Jerrington

+0

행이 축소되었습니다. – blawford