I have the following code set up. The simulator crashes when I navigate to the view. I am trying to put a picker into my app that displays pay schedules such as Weekly, Semi-Annual, and Annual.
insurancePicker = new Picker()
{
Title = "Insurance Frequency",
VerticalOptions = LayoutOptions.FillAndExpand
};
insurancePicker.Items.Add("Monthly");
insurancePicker.Items.Add("Semi-Annual");
insurancePicker.Items.Add("Annual");
insurancePicker.SelectedIndexChanged += (sender, args) =>
{
if (insurancePicker.SelectedIndex == -1)
{
}
else
{
}
};
I add it to the view like such:
Content = new StackLayout{
Spacing = 20, Padding = new Thickness(10, 10, 10, 0),
Children = {
homeValue,
amountOwed,
new StackLayout{
Spacing = 2,
Orientation = StackOrientation.Horizontal,
Children = {
insurance,
insurancePicker
}
},
new StackLayout{
Spacing = 2,
Orientation = StackOrientation.Horizontal,
Children = {
taxes,
taxesPicker
}
},
btnCalculate
}
};
Below is the stacktrace I get:
mono-rt: Stacktrace:
mono-rt: at <0xffffffff>
mono-rt: at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend_int_int_bool (intptr,intptr,int,int,bool)
mono-rt: at MonoTouch.UIKit.UIPickerView.Select (int,int,bool) [0x00010] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIPickerView.g.cs:185
mono-rt: at Xamarin.Forms.Platform.iOS.PickerRenderer.UpdatePicker ()
mono-rt: at Xamarin.Forms.Platform.iOS.PickerRenderer.OnModelSet (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewRenderer.SetModel (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewPackager.HandleChildAdded (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.EnumerableExtensions.ForEach (System.Collections.Generic.IEnumerable
1<T>,System.Action
1)mono-rt: at Xamarin.Forms.Platform.iOS.ViewPackager.Load ()
mono-rt: at Xamarin.Forms.Platform.iOS.ViewRenderer.SetUpEventHandlers (MonoTouch.UIKit.UIView)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewRenderer.OnModelSet (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewRenderer.SetModel (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewPackager.HandleChildAdded (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.EnumerableExtensions.ForEach (System.Collections.Generic.IEnumerable
1<T>,System.Action
1)mono-rt: at Xamarin.Forms.Platform.iOS.ViewPackager.Load ()
mono-rt: at Xamarin.Forms.Platform.iOS.ViewRenderer.SetUpEventHandlers (MonoTouch.UIKit.UIView)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewRenderer.OnModelSet (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewRenderer.SetModel (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.Platform.iOS.ViewPackager.HandleChildAdded (Xamarin.Forms.VisualElement)
mono-rt: at Xamarin.Forms.EnumerableExtensions.ForEach (System.Collections.Generic.IEnumerable
1<T>,System.Action
1)mono-rt: at Xamarin.Forms.Platform.iOS.ViewPackager.Load ()
mono-rt: at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad ()
mono-rt: at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr)
mono-rt: at <0xffffffff>
mono-rt: at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr)
mono-rt: at MonoTouch.UIKit.UIViewController.get_View () [0x00030] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIViewController.g.cs:2232
mono-rt: at Xamarin.Forms.Platform.iOS.NavigationRenderer/d__d.MoveNext ()
mono-rt: at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Startd__d> (Xamarin.Forms.Platform.iOS.NavigationRenderer/d__d&) [0x0001b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/AsyncTaskMethodBuilder_T.cs:107
mono-rt: at Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushAsync (Xamarin.Forms.Page,bool)
mono-rt: at Xamarin.Forms.Platform.iOS.NavigationRenderer.PushPageAsync (Xamarin.Forms.Page,bool)
mono-rt: at Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushRequested (object,Xamarin.Forms.NavigationRequestedEventArgs)
mono-rt: at Xamarin.Forms.NavigationPage/d__c.MoveNext ()
mono-rt: at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Startd__c> (Xamarin.Forms.NavigationPage/d__c&) [0x0001b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/AsyncTaskMethodBuilder.cs:107
mono-rt: at Xamarin.Forms.NavigationPage.PushAsync (Xamarin.Forms.Page)
mono-rt: at Xamarin.Forms.NavigationPage/NavigationImpl.OnPushAsync (Xamarin.Forms.Page)
mono-rt: at Xamarin.Forms.NavigationProxy.PushAsync (Xamarin.Forms.Page)
mono-rt: at Xamarin.Forms.NavigationProxy.OnPushAsync (Xamarin.Forms.Page)
mono-rt: at Xamarin.Forms.NavigationProxy.PushAsync (Xamarin.Forms.Page)
mono-rt: at FNBMortgageForms.Shared.HomePage.m__1 (object,System.EventArgs) [0x00010] in /Users/Projects/FNBMortgageForms/FNBMortgageForms/Views/HomePage.cs:59
mono-rt: at Xamarin.Forms.Button.SendClicked ()
mono-rt: at Xamarin.Forms.Platform.iOS.ButtonRenderer/<>c__DisplayClass1.b__0 (object,System.EventArgs)
mono-rt: at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00007] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:33
mono-rt: at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr)
mono-rt: at <0xffffffff>
mono-rt: at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr)
mono-rt: at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
mono-rt: at FNBMortgageForms.iOS.Application.Main (string[]) [0x00008] in /Users/Projects/FNBMortgageForms/iOS/Main.cs:17
mono-rt: at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr)
mono-rt: Native stacktrace:
mono-rt:
taxesPicker
? – Stephane Delcroix