//Schedule page
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
public SfSchedule Schedule
{
get { return this.schedule; }
}
}
// Set DataSource
private void Bindable_Clicked(object sender, EventArgs e)
{
ScheduleAppointmentCollection scheduleAppointments = new ScheduleAppointmentCollection();
scheduleAppointments.Add(new ScheduleAppointment
{
StartTime = new DateTime(2020, 2, 4, 10, 0, 0),
EndTime = new DateTime(2020, 2, 4, 11, 0, 0),
Subject = "Meeting"
});
var bindingContext = (App.Current.MainPage as MainPage).Schedule.BindingContext;
if(bindingContext != null && bindingContext is SchedulerViewModel)
{
(bindingContext as SchedulerViewModel).Meetings = scheduleAppointments;
}
} |
<TabbedPage.BindingContext>
<schedulesample:SchedulerViewModel x:Name="scheduleViewModel"/>
</TabbedPage.BindingContext>
<NavigationPage Title="Schedule">
<x:Arguments>
<schedulesample:MainPage BindingContext="{x:Reference scheduleViewModel}"/>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="SignalR Page">
<x:Arguments>
<schedulesample:ButtonPage BindingContext="{x:Reference scheduleViewModel}"/>
</x:Arguments>
</NavigationPage> |
<TabbedPage.BindingContext>
<schedulesample:SchedulerViewModel x:Name="scheduleViewModel"/>
</TabbedPage.BindingContext>
<NavigationPage Title="Schedule">
<x:Arguments>
<schedulesample:MainPage BindingContext="{x:Reference scheduleViewModel}"/>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="SignalR Page">
<x:Arguments>
<schedulesample:ButtonPage BindingContext="{x:Reference scheduleViewModel}"/>
</x:Arguments>
</NavigationPage> |
//Tab page
<NavigationPage Title="Schedule">
<x:Arguments>
<schedulesample:MainPage BindingContext="{x:Reference scheduleViewModel}"/>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="SignalR Page">
<x:Arguments>
<schedulesample:ButtonPage BindingContext="{x:Reference scheduleViewModel}"/>
</x:Arguments>
</NavigationPage>
//SignalR page
private void Button_Clicked(object sender, EventArgs e)
{
var bindingContext = App.Current.MainPage.BindingContext;
if (bindingContext != null && bindingContext is SchedulerViewModel)
{
(bindingContext as SchedulerViewModel).Meetings = scheduleAppointments;
}
} |