0

Animating Helix Tookit TORUS Example

ikonuk 3 months ago • updated by kitchenprovance 2 months ago 2

Dear Friends:

I am slowly getting used to WPF and Helix Toolkit. I really, really like Helix. Although I am a slow learner (retired from academia some years ago), I made great progress. I have recreated several of the Helix examples to learn main features steps by step. I think I have learned everything I need except how to do animation.

By animation, I mean the following. I will draw and texture a deformed pipe based on some numerical computations. I would like draw deformed shape in steps as the pipe bends based on results at each time step.

I am starting first by simulating this process by using a WPF slider control. I am trying to move the object(s) at each (integer) step of slider. I am now trying to achieve this by moving the torus objects (from torus example). I have added a new “Translation” property to MainWindow. I connected this property to a slider. The binding works as I tested it with both a message box and TextBlock display (the code I am posting). I can see that text block contents change and when I enable the MessageBox I can see that “RaiseTranslationChanged” method is activated therefore “trans” variable is updated. Integer “trans” variable is supposed to be use to translate the two torus objects on each side. Unfortunately torus objects do not move.

I suspect that this may be related to “viewmodel” or “dependencyproperty” or both as I can see tube diameter binds quite nicely to the slider. I have a rudimentary understanding of windows messaging system and WPF “datacontext” but I do not seem to understand how they all interact. I would greatly appreciate it if someone could post a solution to this problem and also how I can animate the translation of torus objects in a loop with relatively simple explanation.

Any help would be greatly appreciated. I will also share what I produce at the end and share any credits with anybody who provides input. I am posting both the modified cs and xalm files.

i.konuk




mainwindow.xaml


MainWindow.xaml.cs