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