[英]Listbox is not getting a vertical scrollbar
The main issue people seem to have with the vertical scrollbar not appearing is because they use a stackpanel. 人们似乎对垂直滚动条没有出现的主要问题是因为他们使用堆栈面板。 I went through my complete visual tree and my listbox is not in a stackpanel anywhere. 我经历了完整的可视化树,并且列表框不在任何地方的堆栈面板中。
Here is the XAML that I use: 这是我使用的XAML:
<Grid>
<Grid.Resources>
<local:ReportToListItem x:Key="reportToListItem" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="3" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ListBox Background="PaleGoldenrod" x:Name="Controller_Domain_Reports_OpenReports">
<ListBox.ItemTemplate>
<DataTemplate>
<ContentControl cal:View.Model="{Binding Converter={StaticResource reportToListItem}}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Border Grid.Row="1" Background="Black" Height="3" HorizontalAlignment="Stretch" />
<ListBox Background="Magenta" Grid.Row="2" x:Name="Controller_Domain_Reports_ClosedReports">
<ListBox.ItemTemplate>
<DataTemplate>
<ContentControl cal:View.Model="{Binding Converter={StaticResource reportToListItem}}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
Neither listbox gets a scrollbar if it extends beyond the height of the window for me. 如果列表框超出了我对窗口的高度,则两个列表框都不会获得滚动条。 What am I overlooking? 我在俯视什么?
Just putting this up to close this off properly: 只需将其正确关闭即可:
Do'h.. The shellview had a nice copy pasted list of rowdefinitions all set to auto. 是的。shellview有一个很好的复制粘贴的rowdefinitions列表,所有这些都设置为auto。 Changed the one that contains this view to * and now it works as expected. 将包含该视图的视图更改为*,现在可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.