相关疑难解决方法(0)

如何在ListBox中禁用ScrollViewer?

我有一个ListBox.它有内部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}" />
Run Code Online (Sandbox Code Playgroud)

如何在这样的资源中为ItemContainer的项边框设置样式?据我所知,ContentPresenter是ItemsControl的项容器.但它没有边框,所以我无法设计它.

wpf xaml listbox scrollviewer

11
推荐指数
2
解决办法
2万
查看次数

标签 统计

listbox ×1

scrollviewer ×1

wpf ×1

xaml ×1