默认的WPF行为是您的隐式ScrollBar样式将应用于列表框中的滚动条。如果这不在您的应用程序中发生,那么有一些重写此默认行为。你有一个模板应用到列表框?
我的测试应用,证明了默认样式行为是下面:
<Window x:Class="TestScrollBarStyle.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="Red" />
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<ScrollViewer x:Name="scroll">
<Rectangle Height="200" />
</ScrollViewer>
<ListBox Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListBoxItem>Test 1</ListBoxItem>
<ListBoxItem>Test 2</ListBoxItem>
<ListBoxItem>Test 3</ListBoxItem>
<ListBoxItem>Test 4</ListBoxItem>
<ListBoxItem>Test 5</ListBoxItem>
<ListBoxItem>Test 6</ListBoxItem>
<ListBoxItem>Test 7</ListBoxItem>
<ListBoxItem>Test 8</ListBoxItem>
<ListBoxItem>Test 9</ListBoxItem>
<ListBoxItem>Test 10</ListBoxItem>
<ListBoxItem>Test 11</ListBoxItem>
</ListBox>
</Grid>
它应该像你解释,所以我想,错误的行为是造成别的东西。你可以发布你的ListView组件的代码吗? – Drake 2010-04-28 13:46:56