我有一个包含同步周SfSchedule的页面,当我试图打开该页面时,它会给出以下错误:
System.Reflection.TargetInvocationException:调用的目标引发了异常,InnerException为:{System.ArgumentOutOfRangeException}。应用程序在InitializeComponent();行上崩溃。
I将从我的领域数据库中填充计划的数据源。
这是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;
}当同步包需要更新时,这个问题就开始了,所以我更新了它,但是没有什么改变。
发布于 2016-09-30 13:50:02
我修正了它--我删除了这部分代码:
<ContentPage.BindingContext>
<ViewModels:ActivitiesViewModel/>
</ContentPage.BindingContext>https://stackoverflow.com/questions/39774222
复制相似问题