我在列表框中有一个列表框,当我尝试减小窗口的高度时,列表框的滚动条不会出现。我想显示外部列表框上的滚动条,因为outerlistbox可以有多个内置列表框。 这是我正在使用的XAML。有谁能让我知道这是什么问题?
<ListBox Name="MasterListBox" HorizontalAlignment="Stretch" Width="200">
<ListBoxItem >
<ListBox Name="Child1" BorderBrush="{x:Null}">
<ListBoxItem Content="testing item1" />
<ListBoxItem Content="testing item2" />
<ListBoxItem Content="testing item3" />
<ListBoxItem Content="testing item1" />
<ListBoxItem Content="testing item2" />
<ListBoxItem Content="testing item3" />
<ListBoxItem Content="testing item1" />
<ListBoxItem Content="testing item2" />
<ListBoxItem Content="testing item3" />
<ListBoxItem Content="testing item1" />
<ListBoxItem Content="testing item2" />
<ListBoxItem Content="testing item3" />
<ListBoxItem Content="testing item1" />
<ListBoxItem Content="testing item2" />
<ListBoxItem Content="testing item3" />
<ListBoxItem Content="testing item1" />
<ListBoxItem Content="testing item2" />
<ListBoxItem Content="testing item3" />
</ListBox>
</ListBoxItem>
</ListBox>
答案 0 :(得分:1)
如果我找对你,你不希望内部列表框滚动。
有两种方法可以实现这一目标:
1)将内部列表框更改为ItemsPanel。 2)如果你真的需要将内部控件保存为ListBox,则必须使用内部Listbox控件的Template中的ContentPresenter替换ScrollViewer。看到此链接(标记为正确答案)&gt; http://forums.silverlight.net/t/193872.aspx/1
答案 1 :(得分:0)
将内部listbox
更改为ItemsControl
,然后滚动条不会显示在其中。