UIElement now has controlled invalidation

This seems to alleviate the crashing when minimizing and maximizing
somewhat.