Problem mouse gestures when try using Helix with WPF 3.5

Sep 23, 2011 at 8:04 AM
Edited Sep 23, 2011 at 4:29 PM

I must use WPF 3.5 (.NET 3.5) in my solution.

And I've tried build release of Helix in .NET 3.5.

When using the output .dll files (.xml files included) in an WPF4 application, it's ok. But when I try those .dll files with my WPF3.5 application (also with examples with setting in .NET 3.5), it didn't recognize mouse gestures.

Any advice??

Sep 23, 2011 at 8:09 AM

Problem happened when I was trying to rotate the model in HelixViewbox3D

Sep 23, 2011 at 9:43 AM
Edited Sep 24, 2011 at 5:37 AM

I've found the reason. Somehow binding in .NET 3.5 is different with in .NET 4.0.

In .NET 3.5, the bindings in those lines in theme "Generic.xaml" don't work:

   <local:InputBindingX Gezture="{Binding Path=ResetCameraKeyGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ResetCameraCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=RotateGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.RotateCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=PanGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.PanCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=ZoomGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ZoomCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=ZoomRectangleGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ZoomRectangleCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=ChangeFieldOfViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ChangeFieldOfViewCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=ChangeLookAtGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ChangeLookAtCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=ZoomExtentsGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ZoomExtentsCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=ResetCameraGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ResetCameraCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=TopViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}"  Command="{x:Static local:CameraController.TopViewCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=BottomViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}"  Command="{x:Static local:CameraController.BottomViewCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=LeftViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}"  Command="{x:Static local:CameraController.LeftViewCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=RightViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}"  Command="{x:Static local:CameraController.RightViewCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=FrontViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}"  Command="{x:Static local:CameraController.FrontViewCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=BackViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}"  Command="{x:Static local:CameraController.BackViewCommand}"/>
   <local:InputBindingX Gezture="{Binding Path=OrthographicToggleGesture, RelativeSource={RelativeSource Mode=Self}}"  Command="{x:Static local:HelixViewport3D.OrthographicToggleCommand}"/>

So, I write some additional binding code in HelixViewport3D.OnApplyTemplate() doing the same work:


            if (this.cameraController == null)
                this.cameraController = this.Template.FindName(PartCameraController, this) as CameraController;
                if (this.cameraController != null)
                    this.cameraController.Viewport = this.Viewport;
                    this.cameraController.InputBindings.Add(new InputBinding(CameraController.RotateCommand, this.RotateGesture));

I think this's a notable attention for you.

Sep 30, 2011 at 5:30 AM

thanks for the feedback, I will have a look at this soon.

I will check if setting the input bindings in code could help - note that the xaml also bind the gestures.

Oct 3, 2011 at 5:59 PM

I just tried building the library with .NET 3.5, and everything seems to work ok. The mouse gestures work just like they do in 4.0.

Can you try again, and let us know if you still have the problem.

Oct 4, 2011 at 1:54 AM

If I compile HelixToolkit in .NET 3.5   AND   use the library in a .NET 3.5 WPF project, the problem will happen

Oct 31, 2011 at 1:37 PM

Hey there, I'm currently toying with the panorama sample but am having trouble alternating between the left mouse button (LMB) and the default right mouse button (RMB) for controlling the camera around the pano's.

How would I go about changing this gesture?

Thank you.

Oct 31, 2011 at 3:11 PM

Search for InitBinding() function in solution, you'll see ;)

Nov 1, 2011 at 10:55 AM

I'm having difficulty finding that function Việt.

I firstly used Ctrl+F to search the above throughout the entire solution, but found nothing.

I then searched throughout the HelixToolkit reference in the object browser, but could locate nothing.

I searched throughout Google with the above function as keywords, but located only Java-related articles, but did find one C#-related article with no thorough material that I could've used.

If you are able to assist me further please do so, I would really love to swop the default right-button manoeuvring to the left-button.

Thank you, Keith.

Nov 1, 2011 at 3:57 PM

the function is CameraController.InitializeBindings() . Sorry for my mistake.

You can find these things in HelixToolkit project that make input structure:

---- The binding for intput: in file Themes\Generic.xaml

this contains the ControlTemplate for the HelixViewport3D. You can find tag CameraController.InputBindings in this file. It bind gestures with corresponding command of CameraController (a part of HelixViewport3D).

---- The gesture definitions: in file Controls\HelixViewport3D.cs

this contains default definitions for all mouse gesture. You can find RotateGestureProperty . It is set MouseAction.RightClick. Change it to MouseAction.LeftClick for your need.

---- The binding for commands: in file Controls\CameraController\CameraController.cs

in function InitializeBindings() you can see the binding for command with corresponding handler. If you want to change what to do with a command, you can make it here.




Nov 1, 2011 at 7:37 PM

thanks for replying to this question, Việt! You are right, the RotateGesture property should be used to change which mouse button to use. I think you can also add additional InputBindings to the HelixViewport3D instance, but I have not tested this. 

Nov 2, 2011 at 1:01 PM

Thank you very much for that Việt.

I have now implemented my panorama project with left-click mouse gesturing.

Also, I have updated my project to the now stable engine status.

Within the project there is jumping from panorama to panorama through xml.

However, I am experiencing problems with that very functionality whereas with engine version: it worked suitably.

Below are links to the updated/original versions of the project.

Please help in debugging this, if availability prevents this, then I can resort to the original use of the version. Although, progress would be nice (I like the new 'Move' cursor, it's seemingly more fluid!).

Thank you Việt for your help, and thank you Objo for your wonderful engine.


Nov 2, 2011 at 1:33 PM

Here are the links (Mediafire):


(If the 'PanoramaCube3D' Source is set to 'Opera' then the MouseWheel function should be set to GrandHotel, and vice versa.

The zoom point is in the XML. For 'Opera', the zoom point in on the steps to the very left of the 'Right' face between the two lights.

For 'GrandHotel', the zoom point is on the face - 'Back' - and is located on the policeman with horse foot-patrol.)

Updated (Present):


Nov 2, 2011 at 6:56 PM

cool project, I like the way you zoom in to go to a new panorama :)

Reading the transition.xml didn't work with my culture (',' decimal point) - so I just added this line to your demo            

Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

The rotation gesture can be set by xaml:

  <MouseGesture MouseAction="LeftClick"/>

or in code

myHelixView3D.RotateGesture = new MouseGesture(MouseAction.LeftClick);

I see there are a few more features to be added to the control (e.g. don't allow change of camera position, reset camera etc. in this application) but I don't have time to implement that myself right now.

Nov 3, 2011 at 10:48 AM

Ahh, Objo, so you managed to transition onto a new panorama in the updated version?!

I am having difficulty doing this. There is no 'RotateGesture' in the original version which is why I am limited to progress with my alpha-state reference library.

Please do so continue working on those features and keep me notified of updated.

Or suggest to me some guidance on progressing them myself.

I'm currently trying to implement some visual cue's (hotspots) for multimedia, using the same ideology as that what I'm using for the transitioning hotspot's.

Would you be able to link me to a download of the project with the above fixes?

Thank you, Keith.

Nov 3, 2011 at 10:04 PM

hi Keith, I only checked that RotateGesture property worked as intended. Sorry I don't know why your hotspot code doesn't work. Did you consider using spherical coordinates for the hotspots?