正如问题所示,我无法让滚动条显示在我的listView中。使用网格替换StackPanel有效,但问题是我在选项卡控件中的两个列表视图然后堆叠在彼此的顶部和我拥有的标签上。建议?
List<T>
答案 0 :(得分:2)
将StackPanel
(s)替换成Grid
个RowDefinitons
:
<TabControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="20,0,0,0" Background="#FF89BBF7">
<TabItem Header="Active Calls">
<TabItem.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FFDDDDDD" Offset="0.5"/>
<GradientStop Color="#FF89BBF7" Offset="1"/>
</LinearGradientBrush>
</TabItem.Background>
<Grid Background="#FF89BBF7" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ListView Name="lvwCalls" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="Auto" Margin="10,10,10,40" >
<ListView.View>
<GridView>
<GridViewColumn Header="Priority" Width="50" DisplayMemberBinding="{Binding priority}" />
<GridViewColumn Header="Call Status" Width="60" DisplayMemberBinding="{Binding callStatus}" />
<GridViewColumn Header="Call Type" Width="60" DisplayMemberBinding="{Binding callType}" />
<GridViewColumn Header="Dispatched Persons" Width="120" DisplayMemberBinding="{Binding dispatchedPersons}" />
<GridViewColumn Header="Region" Width="50" DisplayMemberBinding="{Binding region}" />
<GridViewColumn Header="Location" Width="80" DisplayMemberBinding="{Binding location}"/>
<GridViewColumn Header="Specific Location" Width="100" DisplayMemberBinding="{Binding specLocation}" />
<GridViewColumn Header="Time" Width="50" DisplayMemberBinding="{Binding time}" />
<GridViewColumn Header="Dispatch #" Width="60" DisplayMemberBinding="{Binding dispatchNumber}" />
<GridViewColumn Header="Address" Width="60" DisplayMemberBinding="{Binding address}" />
</GridView>
</ListView.View>
</ListView>
<Label Content="Pending Calls:" Grid.Row="1"/>
<ListView HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="Auto" Margin="10,10,10,50" Grid.Row="2">
<ListView.View>
<GridView>
<GridViewColumn Header="Priority" Width="120" DisplayMemberBinding="{Binding Priority}" />
<GridViewColumn Header="Call Type" Width="120" DisplayMemberBinding="{Binding CallType}" />
<GridViewColumn Header="Location" Width="150" DisplayMemberBinding="{Binding Location}" />
<GridViewColumn Header="Specific Location" Width="100" DisplayMemberBinding="{Binding SpecLocation}" />
<GridViewColumn Header="Time" Width="100" DisplayMemberBinding="{Binding Time}" />
<GridViewColumn Header="Dispatch #" Width="100" DisplayMemberBinding="{Binding DispatchNumber}" />
</GridView>
</ListView.View>
</ListView>
</Grid>
</TabItem>
<TabItem Header="History">
<Grid Background="#FF89BBF7">
<ListView HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="Auto" Margin="10,10,10,20" >
<ListView.View>
<GridView>
<GridViewColumn Header="Call Time" Width="70" DisplayMemberBinding="{Binding CallTime}" />
<GridViewColumn Header="Location" Width="80" DisplayMemberBinding="{Binding Location}" />
<GridViewColumn Header="Specific Location" Width="100" DisplayMemberBinding="{Binding SpecLocation}" />
<GridViewColumn Header="Dispatch Number" Width="120" DisplayMemberBinding="{Binding DispatchNumber}" />
<GridViewColumn Header="Description" Width="80" DisplayMemberBinding="{Binding Description}" />
<GridViewColumn Header="Report Number" Width="100" DisplayMemberBinding="{Binding ReportNumber}" />
<GridViewColumn Header="Group" Width="60" DisplayMemberBinding="{Binding Group}" />
<GridViewColumn Header="Address" Width="80" DisplayMemberBinding="{Binding Address}" />
</GridView>
</ListView.View>
</ListView>
</Grid>
</TabItem>
</TabControl>
ScrollViewers
和StackPanels
不能很好地协同工作: