2013-02-13 3 views
5

다른 사람들과 마찬가지로 스크롤 막대가 표시되지 않는 DataGrid가 있습니다. 내 상황에 고유 한 생각은 시각적 또는 논리적 트리에서 StackPanel을 볼 수 없다는 것입니다. WPF Inspector를 사용하여 나무를 봅니다. 나는 격자 열과 행을 포함하는 높이와 너비를 성공으로 설정하기위한 다양한 제안을 시도했다. 내가 볼 수있는 영역을 벗어나는 내용을 허용하고 있지만 그것이 아직 무엇인지 말할 수 없다는 것이 확실합니다. 어떤 도움을 주시면 감사하겠습니다. 이 응용 프로그램은 MEF 응용 프로그램과 WPF 프리즘이며 DataGrid는 프리즘 영역에있는 UserControl 내에 있습니다.WPF DataGrid에 스크롤 막대가 표시되지 않고 표시 영역이 누락되었습니다.

쉘 창 XAML :

<Window> 
    <Grid x:Name="GridOuterShell"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
     <RowDefinition Height="Auto"/> 
    </Grid.RowDefinitions> 

    <ribbon:Ribbon Grid.Row="0" > 
     ... 
    </ribbon:Ribbon> 

    <Grid x:Name="GridShellContent" Grid.Row="1"> 
     <Grid.RowDefinitions> 
      <RowDefinition /> 
      <RowDefinition Height="Auto" /> 
      <RowDefinition /> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="350" MinWidth="300"/> 
      <ColumnDefinition Width="Auto"/> 
      <ColumnDefinition Width="*"/> 
     </Grid.ColumnDefinitions> 


     <local:RegionBorderControl Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" Margin="2,2,8,2" RegionName="{Binding MainRegionDisplayName}" 
           Style="{DynamicResource RegionBorderControlStyle}"> 
     <ContentControl prism:RegionManager.RegionName="MainRegion" 
         VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/> 

     </local:RegionBorderControl> 


     <GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" HorizontalAlignment="Center" VerticalAlignment="Stretch" 
        Width="3" ShowsPreview="True" ResizeDirection="Columns" /> 

     <local:RegionBorderControl Grid.Row="0" Grid.Column="2" RegionName="{Binding RightTopRegionDisplayName}" 
           Style="{DynamicResource RegionBorderControlStyle}"> 
     <ContentControl prism:RegionManager.RegionName="RightTopRegion" 
         VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/> 

     </local:RegionBorderControl> 

     <GridSplitter Grid.Row="1" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" 
        Height="3" ShowsPreview="true" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" Background="Silver"/> 

     <local:RegionBorderControl Grid.Row="2" Grid.Column="2" RegionName="{Binding RightBottomRegionDisplayName}" 
           Style="{DynamicResource RegionBorderControlStyle}"> 
      <ContentControl prism:RegionManager.RegionName="RightBottomRegion"/> 

     </local:RegionBorderControl> 

    </Grid> 

    <StatusBar Grid.Row="2"> 
     ... 
    </StatusBar> 

    </Grid> 
</Window> 

UserControl을 XAML :

<UserControl> 

<Grid x:Name="GridMain"> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition/> 
     </Grid.ColumnDefinitions> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="Auto"/> 
      <RowDefinition /> 
      <RowDefinition Height="Auto"/> 
     </Grid.RowDefinitions> 

     <DockPanel Grid.Row="0" LastChildFill="False" HorizontalAlignment="Stretch" Width="Auto" > 
      <ToolBar x:Name="tbToolBar" DockPanel.Dock="Left" Background="{x:Null}"> 
       ... 
      </ToolBar> 
     </DockPanel> 

     <DataGrid AutoGenerateColumns="False" Grid.Row="2" Name="DataGridList" ItemsSource="{Binding MyItems}" IsReadOnly="True" CanUserResizeRows="False" SelectionMode="Single" 
        SelectedItem="{Binding Path=SelectedDataGridRecord, Mode=TwoWay}" Style="{StaticResource DataGridDefault}" > 
      <DataGrid.Columns> 
       ... 
      </DataGrid.Columns> 
     </DataGrid> 

    </Grid> 

답변

14

당신은 그리드가 측정됩니다 있도록 RowDefinition의 높이가 자동 인 그리드 행의 데이터 그리드를 무한의 높이로 DesiredSize.Height에 배치되어 스크롤 바를 표시하지 않습니다. 눈금이 행 1에 있어야하거나 행 2의 높이가 자동 대신 *가되어야합니다.

+0

이렇게하면 문제가 해결됩니다. 감사합니다 앤드류. 나는 이것을 시도했다는 것을 맹세 할 수 있었다. 그러한 명백한 감독을 게시하는 것에 대해 유감스럽게 생각하지만 나는 다른 무엇도 의미가 없었기 때문에 그와 비슷한 것이라고 확신했다. – David

관련 문제