Xamarin.forms 标签页Xamarin表单

Xamarin.forms 标签页Xamarin表单,xamarin.forms,syncfusion,tabbedpage,Xamarin.forms,Syncfusion,Tabbedpage,我使用syncfusion时间表,我使用选项卡式页面显示两种不同的每日时间表: MainPage = new TabbedPage{ Children = { new DailyView(), new DailyViewMaterials() } }; DailyView和DailyViewMaterials这两个页面具有相同的样式:上面有两个标签,然后是一个SynyFusion明细表,但明细表具有不同的数据源和不同的约会 当我运行项目并单击约会时,它将显示

我使用syncfusion时间表,我使用选项卡式页面显示两种不同的每日时间表:

MainPage = new TabbedPage{
  Children =
  {
      new DailyView(),
      new DailyViewMaterials()
  }
};
DailyView和DailyViewMaterials这两个页面具有相同的样式:上面有两个标签,然后是一个SynyFusion明细表,但明细表具有不同的数据源和不同的约会

当我运行项目并单击约会时,它将显示一个包含约会详细信息的框架。首先,它可以正常工作,但当我切换到第二页,然后切换回第一页并单击约会时,它会触发第二个日程表的appointmentClicked事件,有解决方案吗

编辑:


谢谢

一些DataContext错误?它没有给我一个错误或异常,我切换了如下位置:MainPage=new TabbedPage{Children={new DailyViewMaterials(),new DailyView()};当我切换到第二个页面并切换回第一个页面时,第一个页面总是不显示点击时的单元格内容。请您显示一些DailyView?@Mireille,问题仍然存在?一些DataContext错误?它不会给我错误或异常,我切换了如下位置:MainPage=new TabbedPage{Children={new DailyViewMaterials(),new DailyView()}};当我切换到第二页并切换回第一页时,第一页总是不显示点击时的单元格内容。你能显示一些DailyView的代码吗?@Mireille,问题仍然存在吗?
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local="clr-namespace:eAgenda1"
         xmlns:ViewModels="clr-namespace:eAgenda1.ViewModels;assembly=eAgenda1"
         xmlns:Models="clr-namespace:eAgenda1.Models;assembly=eAgenda1"
         xmlns:ActivitiesDailySchedule="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
         x:Class="eAgenda1.DailyView"
         Title="Activities"
         BackgroundColor="White">
    <ContentPage.BindingContext>
      <ViewModels:ActivitiesViewModel/>
    </ContentPage.BindingContext>
    <ContentPage.Padding>
     <OnPlatform x:TypeArguments="Thickness"  iOS="0, 20, 0, 0" Android="0"  WinPhone="0" />
    </ContentPage.Padding>
<StackLayout x:Name ="acitivitiesMainStack"
           HorizontalOptions="FillAndExpand"
           VerticalOptions="FillAndExpand">
<Label x:Name="dateLabel"
       HorizontalOptions="Center"
       VerticalOptions="Center"
       FontSize="Large"/>
<Label x:Name="weekLabel"
       HorizontalOptions="End"
       HorizontalTextAlignment="Center"/>
<ActivitiesDailySchedule:SfSchedule x:Name="activitiesSchedule"
                          BackgroundColor="White"
                          HorizontalOptions="FillAndExpand"
                          VerticalOptions="FillAndExpand"
                          ScheduleView="DayView"
                          ShowAppointmentsInline="True"
                          DataSource="{Binding ActivitiesCollection}"
                         ScheduleCellTapped="ActivitiesSchedule_CellTapped">
</ActivitiesDailySchedule:SfSchedule>
<Frame x:Name="appointmentDetailsFrame"
       VerticalOptions="CenterAndExpand"
       OutlineColor="Accent"
       IsVisible="False">
  <StackLayout>
    <StackLayout Orientation="Horizontal">
      <StackLayout HorizontalOptions="Start">
        <Label x:Name="subjectLabel"
          FontSize="Large"/>
        <Label x:Name="descriptionLabel"
               FontSize="Medium"/>
      </StackLayout>
      <StackLayout HorizontalOptions="EndAndExpand">
        <Label x:Name="typeLabel"
               HorizontalTextAlignment="End"
               FontSize="Medium"/>
        <Label x:Name="timeLabel"
               HorizontalTextAlignment="End"
               FontSize="Small"/>
      </StackLayout>
    </StackLayout>
    <Button x:Name="cancelButton"
            Text="OK"
            Clicked="CancelClicked"/>
  </StackLayout>
</Frame>
 void CancelClicked(object sender, EventArgs args)
    {

        appointmentDetailsFrame.IsVisible = false;
        activitiesSchedule.IsVisible = true;
    }
    void ActivitiesSchedule_CellTapped(object sender, ScheduleTappedEventArgs args)
    {
        if (args.selectedAppointment != null)
        {    
            activitiesSchedule.IsVisible = false;
            appointmentDetailsFrame.IsVisible = true;
            var selectedAppointment = (Activity)args.selectedAppointment;
            typeLabel.Text = selectedAppointment.Type;
            subjectLabel.Text = selectedAppointment.Subject;
            descriptionLabel.Text = selectedAppointment.Description;
            timeLabel.Text = selectedAppointment.Time;
            System.Diagnostics.Debug.WriteLine(selectedAppointment.Type);
        }

        else
        {
            System.Diagnostics.Debug.WriteLine("No activities");
        }
    }