2016-09-29 69 views
0

我有一个包含Syncfusion每周SfSchedule页面,当我尝试打开它给我这个错误的页面:Xamarin窗体System.Reflection.TargetInvocationException:异常已通过调用的目标引发异常

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation and the InnerException is: {System.ArgumentOutOfRangeException}. The App crashes on InitializeComponent(); line.

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

这是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包。

回答

0

我固定它我删除这部分代码:

<ContentPage.BindingContext> 
    <ViewModels:ActivitiesViewModel/> 
</ContentPage.BindingContext> 
相关问题