Skip to content

Instantly share code, notes, and snippets.

@danielkon96
Created September 20, 2019 23:13
Show Gist options
  • Save danielkon96/2fdd52617f6c40ca4344f35aa8b0e317 to your computer and use it in GitHub Desktop.
Save danielkon96/2fdd52617f6c40ca4344f35aa8b0e317 to your computer and use it in GitHub Desktop.
Code example of applying images to a carousel view
//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