I’m wanting to ensure a control remains in a certain state for a minimum amount of time. The control has two states: Loading and Loaded. The Loading state displays an animation and the Loaded state displays the data. There is a fade in/out transition between the two states.
However, the problem is sometimes the data loads so quickly that the animation flicks up on the screen momentarily and then immediately fades out. This looks poor, so what I want to do is impose a minimum amount of time (e.g. half a second) spent in the Loading state. That way, even if the data loads quickly, the loading animation will at least display for long enough not to have a jarring effect.
I’ve managed to achieve this with a custom VisualStateManager that I imaginitively called MinimumTimeVisualStateManager. However, I’m wondering whether there’s a built-in way to achieve what I want without the need for this extra code.
Thanks
Here’s my solution:
And it is used like this:
It seems to work just fine, but am hoping this is code I can remove.
Kent