2016-09-29 90 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> 
相關問題