我制作了一个简单的图像编辑器,并且我有一个ScrollViewer元素,我在其中放置了一张图片.Scrollview有一些用于放大和缩小图片的绑定:
<ScrollViewer>
<ScrollViewer.InputBindings>
<MouseBinding Gesture="{ext:MouseWheel Direction=Up, Keys=Control}" Command="{Binding ZoomInImageCommand}"/>
<MouseBinding Gesture="{ext:MouseWheel Direction=Down, Keys=Control}" Command="{Binding ZoomOutImageCommand}"/>
</ScrollViewer.InputBindings>
...
</ScrollViewer>
在工具栏上有一些工具,比如光标(什么都不做,只是在图像周围移动),裁剪,旋转等.
<ToolBar>
<RadioButton x:Name="CursorTool" Style="{StaticResource {x:Type ToggleButton}}">
...
</RadioButton>
<RadioButton x:Name="CropTool" Style="{StaticResource {x:Type ToggleButton}}">
...
</RadioButton>
...
</ToolBar>
因此,我需要一个滚动浏览器的绑定工作时,只有光标工具被选中.如何才能做到这一点?