Xamarin Forms System.Reflection.TargetInvocationException:调用目标抛出了异常

时间:2016-09-29 15:20:25

标签: xamarin.forms syncfusion sfschedule

当我尝试打开页面时,我有一个包含Syncfusion每周@Override protected Dialog onCreateDialog(int id) { // TODO Auto-generated method stub if (id == 999) { df.format(today); month = today.getMonth(); year = today.getYear(); day = today.getDay(); DatePickerDialog dlg = new DatePickerDialog(this, myDateListener, year, month, day); return dlg; } return null; } private DatePickerDialog.OnDateSetListener myDateListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) { year = arg1; month = arg2; day = arg3; Date date = new Date(year,month,day); df.format(date); reportDate = df.format(date); date_from.setText(reportDate); } }; 的页面,它给了我这个错误:

  

System.Reflection.TargetInvocationException:抛出了异常   通过调用的目标和InnerException是:   {} System.ArgumentOutOfRangeException。该应用程序崩溃了   的InitializeComponent();线。

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

这是XAML代码:

SfSchedule

这就是背后的代码:

<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>

当Syncfusion软件包需要更新时,这个问题就开始了,所以我更新了它但没有任何改变。

1 个答案:

答案 0 :(得分:0)

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

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