I have a rectangle with its Visibility property bound to the view-model. For (apparent) performance reasons, I’m setting the DataContext in the page’s Loaded event. This rectangle should be collapsed by default. Unfortunately, with this “late-context” pattern, the rectangle shows for a few fractions of a second.
Is there a no-code way to make it collapsed by default?
If no, I could simply set the property to Collapsed and bind it in the Loaded event, but I have many such rectangles in my app.
Could I implement a ContentControl that is collapsed until loaded? Is that second idea too far-fetched?
I made an
AppearingControlwho’s implementation defies calling this “coding” since it’s so simple:`I can use the control this way:
Can someone confirm I didn’t just reinvent the wheel, or worse, use a bazooka to kill a fly?
Thanks.