0
我有一个自定义列表框。但不显示滚动条。列表框不显示垂直滚动条WPF
<Style x:Key="noStyleToListboxItem" TargetType="{x:Type ListBox}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="BorderBrush" Value="Black"></Setter>
<Setter Property="BorderThickness" Value="2"></Setter>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="True"></Setter>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"></Setter>
<Setter Property="VirtualizingPanel.ScrollUnit" Value="Pixel"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border>
<ContentPresenter/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
垂直滚动条未显示。
变化'VerticalScrollBarVisibility'到TRUE;或不管它被称为在'ListBox' ....和类型是怪异因为它是'ListBoxItem'的代码 – FCin