Last active
August 29, 2015 14:21
-
-
Save RedTahr/f3fa74e815576a08a4d2 to your computer and use it in GitHub Desktop.
Xamarin.Forms ActivityIndicator in code with FadeOut of indicator and FadeIn of content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Xamarin Evolve 2014: Extending Xamarin.Forms with Custom Controls - Jason Smith, Xamarin https://www.youtube.com/watch?v=pIZ8G47KPIM | |
protected async override void OnAppearing() { | |
base.OnAppearing(); | |
var loadingView = new ActivityIndicator { | |
VerticalOptions = LayoutOptions.Center, | |
HorizontalOptions = LayoutOptions.Center, | |
IsRunning = true | |
}; | |
if (initialLoad) { | |
var normalContent = Content; | |
Content = loadingView; | |
await Task.Delay(1500); | |
await loadingView.FadeTo(0, 100); | |
normalContent.Opacity = 0; | |
Content = normalContent; | |
await normalContent.FadeTo(1, 500); | |
initialLoad = false; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ActivityIndicator IsVisible="{Binding IsBusy}" IsRunning="{Binding IsBusy}" | |
AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5, 0.5, AutoSize, AutoSize" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment