I'm passing one parameter from one page to the Tabbed page. I want to use that parameter in all child pages. How can I pass that parameter to child pages.
Tabbed Page XAML:
<?xml version="1.0" encoding="utf-8" ?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="VSS.MasterPages.VendorScheduleTabbedPage" xmlns:views="clr-namespace:VSS.MasterPages" BarBackgroundColor="#f2f0f0" NavigationPage.HasBackButton="False"> <NavigationPage.TitleView> <Button BackgroundColor="Transparent" Image="back.png" BorderRadius="10" BorderWidth="2" BorderColor="#375587" HorizontalOptions="StartAndExpand" WidthRequest="50" ></Button> </NavigationPage.TitleView> <TabbedPage.Children> <NavigationPage Title="Day" Icon="calendarIcon.png"> <x:Arguments> <views:DaySchedulePage/> </x:Arguments> </NavigationPage> <NavigationPage Title="Week" Icon="calendarIcon.png" > <x:Arguments> <views:WeekSchedulePage/> </x:Arguments> </NavigationPage> <NavigationPage Title="Month" Icon="calendarIcon.png"> <x:Arguments> <views:MonthSchedulePage/> </x:Arguments> </NavigationPage> </TabbedPage.Children> </TabbedPage>
TabbedPage CS code:
public partial class VendorScheduleTabbedPage : Xamarin.Forms.TabbedPage { private VendorCustomerVM _customerDetails; public VendorScheduleTabbedPage(VendorCustomerVM customerDetails) { InitializeComponent(); _customerDetails = new VendorCustomerVM(); _customerDetails = customerDetails; On<Android>().SetBarItemColor(value: Color.FromHex("#6699FF")); On<Android>().SetBarSelectedItemColor(value: Color.Orange); } override protected void OnCurrentPageChanged() { base.OnCurrentPageChanged(); if (this.CurrentPage.Title == "Week") { MessagingCenter.Send<object>(this, "Week"); } else if (this.CurrentPage.Title == "Month") { MessagingCenter.Send<object>(this, "Month"); } else { MessagingCenter.Send<object>(this, "Day"); } } }