Forum General
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Getting specific data from carousel object

jmansajmansa Member ✭✭

Hi, I am creating a dynamic carousel with students. This part works just fine, but I would like to be able to click on each sudent and then navigate to a new page with their information on it, and that I am really struggling with :smile: -/

Here is how i generate the carousel from an ObservableCollection:
ObservableCollection collection = new ObservableCollection();

collection.Add(new StudentData { name = "Soren Hanson", schoolclass = "4. grade", course = "Math" });
collection.Add(new StudentData { name = "Michael Trane", schoolclass = "7. grade", course = "English" });
collection.Add(new StudentData { name = "Tammy Jump", schoolclass = "1. grade", course = "English" });

Now, I am using a datatemplate to generate each student to the carousel like this:
DataTemplate template = new DataTemplate(() =>
var imageBtn = new Button();
imageBtn.Image = "Images/default.png";

    imageBtn.Clicked += delegate {

        //App.currStudent = collection.......

        var menteeOptions = new MenteeOptions();


carousel.ItemTemplate = template;
carousel.PositionSelected += pageChanged;
carousel.ItemsSource = collection;

As you can see, I am trying, when I click the button, to get the specific student into an temporary StudentData object, but am not succesfull :-(

I really hope someone can help me here cause I am kind of stuck!

Thanks in advance.


Sign In or Register to comment.