【发布时间】:2010-12-16 21:20:09
【问题描述】:
我有一个列表框。它有内部 ScrollViewer,所以我可以用鼠标滚轮滚动 ListBox 内容。在我设置包含另一个 ListBox 的项目模板之前它工作正常(事实上,我有 4 个嵌套的 ListBoxes =))。问题是内部 ListBox 的 ScrollViewer 窃取了滚动事件。有什么简单的方法可以防止这种行为吗?
我有这样的 ListBox 和 ItemContainerStyle:
<Style x:Key="ListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="BorderBrush" Value="Black"/>
...
</Style>
<ListBox ItemContainerStyle="{StaticResource ListBoxItemStyle}" />
如何在这样的资源中为 ItemContainer 的项目边框设置样式?据我所知,ContentPresenter 是 ItemsControl 的项目容器。但它没有边框,所以我无法设置它的样式。
【问题讨论】:
标签: wpf xaml listbox scrollviewer