I'm making a little math game in WPF and I have some "falling textblocks" that contain multiplications that you have to answer correctly before they reach the bottom of the window.
Currently it looks like this
What I'm doing right now is that each textblock is a custom WPF control that contains a textblock to represent the expression and a textbox where user can input the answer to that expression. These are generated inside of a 40x20 grid where I'm using a DispatcherTimer
to continiously move them down the grid until the reach the end of the grid.
There are two main problems with this approach:
- The "effect" of falling isn't very smooth, it's very choppy, I have been able to improve the fluidity of the movement somewhat by expanding the grid downwards and decreasing the interval at which the
DispatcherTimer
ticks but it is at best a band-aid solution and I can still tell that the movement is very mechanical. - The other problem is closely related to the first one, whenever a textbox of these falling expressions is focused the falling becomes far far worse, it really slows to a crawl I'm guessing redrawing each and every control while having focus on a textbox is severely decreasing the performance which is causing this.
Anyhow because of this, I am seeking an alternative way of doing this, preferably it has to be easy to use and easy to integrate with my current code.