ListView与ScrollViewer但没有MouseWheelEvents

时间:2013-08-26 10:06:51

标签: wpf

我有以下列表:

ListViews with Expander-Items

这些是带有Expanders的ListView作为ListViewItems。 ListView本身位于ScrollViewer中以实现正确的滚动行为。 我的问题是MouseWheel没有在这个List上工作。

这是XAML:

<Window x:Class="ResourceListExpanderStyle.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converter="clr-namespace:ResourceListExpanderStyle.Converter"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <converter:DeviceTypeGroupToDeviceListConverter x:Key="DeviceTypeGroupToDeviceListConverter" />
    <converter:IntegerToBrushConverter x:Key="IntegerToBrushConverter" />
</Window.Resources>
<DockPanel>
    <ScrollViewer x:Name="ScrollViewer">
        <ListView x:Name="OuterListView" ItemsSource="{Binding DeviceTypeGroupListByStation}" HorizontalContentAlignment="Stretch">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Expander Header="{Binding Path=NAME}" Background="{Binding Path=BACKCOLOR, Converter={StaticResource IntegerToBrushConverter}}">
                        <ListView x:Name="InnerListView" ItemsSource="{Binding Converter={StaticResource DeviceTypeGroupToDeviceListConverter}}" HorizontalContentAlignment="Stretch">
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=NAME}" Background="{Binding Path=BACKCOLOR, Converter={StaticResource IntegerToBrushConverter}}" />
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                    </Expander>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </ScrollViewer>
</DockPanel>

任何想法?

0 个答案:

没有答案