Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WPF禁用ScrollViewer上的鼠标滚轮,并让孩子们处理它_Wpf_Events_Scrollviewer_Mousewheel_Routed - Fatal编程技术网

WPF禁用ScrollViewer上的鼠标滚轮,并让孩子们处理它

WPF禁用ScrollViewer上的鼠标滚轮,并让孩子们处理它,wpf,events,scrollviewer,mousewheel,routed,Wpf,Events,Scrollviewer,Mousewheel,Routed,我正在尝试实现一个ItemsControl,它包含一组图形组件。组件应该能够使用MouseWheel事件进行缩放,但滚动条似乎首先捕获并处理事件。我找到的大多数文章都是关于让父母来操纵方向盘的,但我需要孩子来操纵方向盘,而我无法找到正确的挂钩。这是我的TileGrid,它的核心是ItemsControl: <ItemsControl x:Class="Grapes.Common.Controls.TiledGrid.TiledGrid" xmlns="http://sch

我正在尝试实现一个ItemsControl,它包含一组图形组件。组件应该能够使用MouseWheel事件进行缩放,但滚动条似乎首先捕获并处理事件。我找到的大多数文章都是关于让父母来操纵方向盘的,但我需要孩子来操纵方向盘,而我无法找到正确的挂钩。这是我的TileGrid,它的核心是ItemsControl:

<ItemsControl x:Class="Grapes.Common.Controls.TiledGrid.TiledGrid"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:Grapes.Common.Controls.TiledGrid"
         xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
         mc:Ignorable="d"
         d:DesignHeight="300" d:DesignWidth="300" x:Name="itemsGrid" 
              ScrollViewer.CanContentScroll="True" >
        <!--ItemTemplate="{Binding ItemTemplate}"-->
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Border BorderBrush="Black" BorderThickness="1"
                        Padding="3" Margin="3" >
                    <HeaderedContentControl
                        HeaderTemplate="{Binding HeaderTemplate,ElementName=itemsGrid}" Header="{Binding}"
                        ContentTemplate="{Binding ItemTemplate,ElementName=itemsGrid}" Content="{Binding}"
                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                        HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                       >
                        <HeaderedContentControl.Template>
                            <ControlTemplate TargetType="HeaderedContentControl">
                                <DockPanel>
                                    <ContentPresenter DockPanel.Dock="Top" ContentSource="Header" />
                                    <ContentPresenter />
                                </DockPanel>
                            </ControlTemplate>
                        </HeaderedContentControl.Template>
                    </HeaderedContentControl>
                </Border>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
        <local:UniformGridPanel Rows="{Binding RowCount,ElementName=itemsGrid}" 
                                Columns="{Binding ColumnCount,ElementName=itemsGrid}" 
                              >

        </local:UniformGridPanel>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.Template>
            <ControlTemplate>
                <Border
        BorderThickness="{TemplateBinding Border.BorderThickness}"
        Padding="{TemplateBinding Control.Padding}"
        BorderBrush="{TemplateBinding Border.BorderBrush}"
        Background="{TemplateBinding Panel.Background}"
        SnapsToDevicePixels="True">
                    <ScrollViewer
                Padding="{TemplateBinding Control.Padding}"
                Focusable="False" FlowDirection="RightToLeft" CanContentScroll="True" SnapsToDevicePixels="True"
                        >

                <ItemsPresenter FlowDirection="LeftToRight">

                </ItemsPresenter>
                    </ScrollViewer>
                </Border>
            </ControlTemplate>
        </ItemsControl.Template>
    </ItemsControl>

如何停止ItemsControl.Template中的ScrollViewer处理鼠标滚轮事件

提前谢谢

迈克