I Am working on xamarin PCL forms app, i was trying to send data from content page to tabbed page. Here i have content page code below
private async void StudentList_ItemTapped(object sender, ItemTappedEventArgs e)
{
var student = StudentList.SelectedItem as Students;
if (student != null) {
var mainViewModel = BindingContext as StudentsViewModel;
if (mainViewModel != null) {
mainViewModel.SelectedStudent = student;
await Navigation.PushAsync(new ProfilePage(mainViewModel));
}
}
}
Now, this ViewModel has property which has getter and setter method implemented which is getting value. My logic in this code is to set value of selecteditem from list and get object of selected person's data. and access that person's data on tabbed page to show it in profile.
Below id tabbed-page.cs
public partial class ProfilePage : TabbedPage
{
public ProfilePage()
{
InitializeComponent();
}
public ProfilePage(StudentsViewModel mainViewModel)
{
InitializeComponent();
BindingContext = mainViewModel;
}
}
if you see its possible to get selected item value when you pass your view-model (which has property to set object value) into parameters by setting it up as binding context and accessing it on another content page by catching it by setting parameter value as same as passed view-model.
Here, my question is how can i achieve that same technique when i am using content page to tabbed page instead content page to content page.
Thanks in advance, please let me know if you do not have idea or you ar what i want to discuss here.