Currently I can zoom using right click. Is there a s开发者_开发技巧imple method to do it with mouse scroll ?
Thanks.
Try something like this:
protected override void OnPreviewMouseWheel(MouseWheelEventArgs e)
{
base.OnPreviewMouseWheel(e);
if(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
{
yourObject.Value += (e.Delta > 0) ? 0.2 : -0.2;
}
精彩评论