【问题标题】:Xamarin Forms System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocationXamarin Forms System.Reflection.TargetInvocationException:调用的目标已引发异常
【发布时间】:2016-09-29 15:20:25
【问题描述】:

我有一个包含每周同步融合SfSchedule 的页面,当我尝试打开该页面时,它给了我这个错误:

System.Reflection.TargetInvocationException:已抛出异常 由调用的目标和 InnerException 是: {System.ArgumentOutOfRangeException}。应用程序崩溃 初始化组件();行。

我正在从我的领域数据库中填充计划的数据源。

这是 XAML 代码:

<ContentPage.Padding>
   <OnPlatform x:TypeArguments="Thickness"
             iOS="0, 20, 0, 0"
             Android="0"
             WinPhone="0" />
 </ContentPage.Padding>

<ContentPage.BindingContext>
  <ViewModels:ActivitiesViewModel/>
</ContentPage.BindingContext>

<WeeklySchedule:SfSchedule x:Name="activitiesWeeklySchedule"
                      BackgroundColor="White"
                      HorizontalOptions="FillAndExpand"
                      VerticalOptions="FillAndExpand"
                      ScheduleView="WeekView"
                      ShowAppointmentsInline="True">
</WeeklySchedule:SfSchedule>

这是背后的代码:

    Realm realm;
    ScheduleAppointmentCollection collection;
    public TeacherWeeklyView() {
        InitializeComponent();
        collection = new ScheduleAppointmentCollection() { };
        var config = new RealmConfiguration() { SchemaVersion = 3 };
        realm = Realm.GetInstance(config);
        var activities = realm.All<ActivitiesItems>();
        foreach (var item in activities) {
           System.Diagnostics.Debug.WriteLine(item.ActivitySubject);
           collection.Add(activity);
        }
        activitiesWeeklySchedule.DataSource = collection;
     }

这个问题是在需要更新 Syncfusion 包时开始的,所以我更新了它,但没有任何改变。

【问题讨论】:

    标签: xamarin.forms syncfusion sfschedule


    【解决方案1】:

    我修复了我删除了这部分代码:

    <ContentPage.BindingContext>
       <ViewModels:ActivitiesViewModel/>
    </ContentPage.BindingContext>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-30
      • 2019-01-22
      • 2021-10-09
      • 1970-01-01
      • 1970-01-01
      • 2018-11-08
      相关资源
      最近更新 更多