Visual elements in Xamarin Forms are made visible/invisible by setting their IsVisible property. Changing some properties or data on visual elements can cause the interface to redraw, which can be expensive.
I'm trying to improve performance on my app so I've introduced caching and tried to make some layout simplifications, but I have to make a lot of visual elements visible/invisible and wondered wht the best way would be to optimise this.
Which is the more efficient operation?
var myButton.IsVisible = true;
Or:
if(!myButton.IsVisible) myButton.IsVisible = true;
If Xamarin already checks the state and decides whether to redraw then the second option is redundant and therefore inefficient. If a redraw happens every time the property is set then it will be more efficient. I can't find any documentation to tell me which is the case.