Derp Derp - 1 year ago 298
C# Question

Change keys Extended WPF Toolkit Zoombox

I'm using the Extended WPF Toolkit's Zoombox. Right now, Ctrl + drag and drop is changing the position, and alt + Scroll is changing the zoom. Logically I'd rather have this turned around since in most software Ctrl+Scroll is used for zooming. How do I change these keys? I played around with

property but can't get it to work.

I tried the following:

<xctk:Zoombox Margin="20" ClipToBounds="False" HorizontalAlignment="Stretch" Name="CanvasZoombox" VerticalAlignment="Stretch" Scale="1" AutoWrapContentWithViewbox="False">

<Viewbox Stretch="Uniform" Name="CanvasViewbox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" OpacityMask="White">
<Canvas Name="LabelCanvas" Background="#FFC3C3C3"/>

This doesn't change anything unfortunately

Answer Source

Since you dont stated, why you didnt got it to work, here an Code-Behind-Example:

  var zoomKeys = new KeyModifierCollection();
  var dragKeys = new KeyModifierCollection();
  this.zoombox.ZoomModifiers = zoomKeys;
  this.zoombox.DragModifiers = dragKeys;

Since these Modifiers are all DependencyProperties, you can also bind them in the MVVM-fashioned way.


The XAML-way


The trick is to wrap the KeyModifier in its suiting collection KeyModifierCollection

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download