C# 激活滚动时,禁用ScrollViewer内的按钮

C# 激活滚动时,禁用ScrollViewer内的按钮,c#,wpf,xaml,scroll,touch,C#,Wpf,Xaml,Scroll,Touch,我的问题如下。当我滚动时,如果我的手指触摸到一个按钮,命令将被调用。如果用户滚动或相反,MVVM体系结构如何最好地停止此操作并停用按钮 <ScrollViewer PanningMode="Both" PanningDeceleration="0.001" PanningRatio="2"> <Grid> <ItemsControl ItemsSource="{Binding ListGstDescriptors}">

我的问题如下。当我滚动时,如果我的手指触摸到一个按钮,命令将被调用。如果用户滚动或相反,MVVM体系结构如何最好地停止此操作并停用按钮

<ScrollViewer  PanningMode="Both" PanningDeceleration="0.001" PanningRatio="2">
        <Grid>
            <ItemsControl  ItemsSource="{Binding ListGstDescriptors}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>

                        <Button  Command="{StaticResource ChangeSavedViewCommand}"
                                CommandParameter="{Binding GstDescriptorAcDescriptor}"/>

                    </DataTemplate>
                </ItemsControl.ItemTemplate>

            </ItemsControl>
        </Grid>
</ScrollViewer>    

当您的滚动移动可以帮助您更好地理解命令时,只需将CanExecute的行为设置为false即可

是的,这是我想做的,但如何知道我的函数CanExecute中的滚动移动是激活的?在ScrollViewer上,当滚动移动时,什么都不会变为真。只需处理ScrollChanged事件,这将仅在滚动移动时触发,因此您可以在手柄中设置布尔字段或直接设置CanExecute。可能是我错了,但像这样,我不知道滚动何时完成,才能将CanExecute设置为真。