Created
September 20, 2019 23:13
-
-
Save danielkon96/2fdd52617f6c40ca4344f35aa8b0e317 to your computer and use it in GitHub Desktop.
Code example of applying images to a carousel view
This file contains 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
//For iOS | |
MessagingCenter.Unsubscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectediOS"); | |
MessagingCenter.Subscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectediOS", (s, images) => | |
{ | |
//If we have selected images, put them into the carousel view. | |
if (images.Count > 0) | |
{ | |
ImgCarouselView.ItemsSource = images; | |
InfoText.IsVisible = true; //InfoText is optional | |
} | |
}); | |
//For Android | |
MessagingCenter.Unsubscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectedAndroid"); | |
MessagingCenter.Subscribe<App, List<string>>((App)Xamarin.Forms.Application.Current, "ImagesSelectedAndroid", (s, images) => | |
{ | |
//If we have selected images, put them into the carousel view. | |
if (images.Count > 0) | |
{ | |
ImgCarouselView.ItemsSource = images; | |
InfoText.IsVisible = true; //InfoText is optional | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment