I have a long running task and I want to show a progress indicator and message.
I have tried using the ActivityIndicator
and while it shows correctly, it allows the underlying controls to be updated.
This Xamarin
iOS
code is just what I want but I need to do it in using Xamarin.Forms
.
http://developer.xamarin.com/recipes/ios/standard_controls/popovers/display_a_loading_message/
Any ideas?
Create a custom renderer that overlays a BoxView over the entire screen. You can customize the color fill and the opacity to show underlying contents to your liking.
You can then center a Xamarin.Forms ActivityIndicator in the middle of the screen to finish off the same effect.
Note - however, currently in v1.2.3x there is a bug on Android that allows underlying controls to still receive user input events, like a button click, despite the BoxView being on-top of everything.
This issues is apparently resolved in the upcoming v1.3 release.
Update 1
Its not easily extractable as its part of a more complex control, however it isn't that difficult to get a similar effect to that in your link.
Try the following in your page:-
Use a Grid as the base (1 row, 1 column), and set it to fill the screen, and set the row and column definitions to GridUnitType.Star.
You can then create your page content like normal as a child of Grid, position this at cell (0,0).
For the next part (you could put this in a control renderer) so that it could be re-used easily across multiple pages. If your not that comfortable with control renderers, you can always create a function to return a Grid object however that you can use across multiple pages:-
Once you have the Grid result from the above, you can add this also to your page's Grid root control, position this again - at cell (0,0).
You can then control the visibility of this overlaying panel on your content.
Naturally you will want to set the IsRunning property of the ActivityIndicator whenever you show / hide the panel. Just create a couple methods like ShowActivityIndicator(), and HideActivityIndicator() perhaps to simplify this though.