2012-03-07 45 views
0

得到了一个带有两个控件listview和lisbox的wpf窗口(始终显示在窗口的高度处)。控制对齐

<Grid >    
     <Grid.ColumnDefinitions> 
      <ColumnDefinition/> 
      <ColumnDefinition Width="230"/> 
     </Grid.ColumnDefinitions> 

     <Grid Grid.Column="0">     
      <Grid.RowDefinitions> 
       <RowDefinition Height="Auto"/> 
      </Grid.RowDefinitions> 

      <local:LeftSideListView Grid.Row="0"/> 
     </Grid> 

     <local:RightSideiveView Grid.Column="1"/>   

    </Grid> 

在这里,我想ListView的高度是汽车 - 所以我一直<RowDefinition Height="Auto"/> 但是当列表视图有显示多个项目,这表明只有几件休息被截断。

如何显示列表视图,其高度为auto同时显示更多项目(>窗口大小) - 显示滚动查看器。

回答

0
下面

是我想要的东西..

<DockPanel Grid.Column="0" HorizontalAlignment="Stretch"> 
      <local:UC_FvExplorer VerticalAlignment="Top"/> 
     </DockPanel> 
0

你需要做的是在LeftSideListView MaxHeight和你的“LayoutRoot”网格之间设置绑定。

<Grid x:Name="LayoutRoot">    
    <Grid.ColumnDefinitions> 
     <ColumnDefinition/> 
     <ColumnDefinition Width="230"/> 
    </Grid.ColumnDefinitions> 

    <Grid Grid.Column="0">     
     <Grid.RowDefinitions> 
      <RowDefinition Height="Auto"/> 
     </Grid.RowDefinitions> 

     <local:LeftSideListView MaxHeight="{Binding ElementName=LayoutRoot, Path=ActualHeight}" Grid.Row="0"/> 
    </Grid> 

    <local:RightSideiveView Grid.Column="1"/>   

</Grid> 

如果LeftSideListView高度将高于LayoutRoot高度其高度将被改变为MaxHeight值和verticalscrollbar将示出大。

+0

感谢Pinga的及时回复.. – Anees 2012-03-07 10:43:31