public override void ViewDidLoad() { //maybe i don't need this controler at all?!?! base.ViewDidLoad (); //this.TableView.Source = new DateTableViewSource (); var section = new Section ("New Checkpoint:"); var nameElement = new EntryElement ("name", "Name your checkpoint", ""); var instructions = new MultilineElement ("specify the time that you expect to complete this checkpoint, each day:"); var targetElement = new TimeElement ("target", DateTime.Now); var aCell = new DatePickerCell(UIDatePickerMode.Time,DateTime.Now) { Key = "1234", }; aCell.TextLabel.Text = "Date"; aCell.RightLabelTextAlignment = UITextAlignment.Right; aCell.OnItemChanged += (object sender, PickerCellArgs e) => { var result = e.Items; }; var saveButton = new StringElement ("save", () =>{ this.Parent.AddNewCheckPoint(nameElement.Value,targetElement.DateValue.TimeOfDay); this.DismissModalViewController(true); }){Alignment=UITextAlignment.Right}; var cancelButton = new StringElement ("cancel", () =>{ this.DismissModalViewController(true); }){Alignment=UITextAlignment.Right}; section.AddAll (new Element[]{ nameElement, instructions, targetElement, saveButton,cancelButton }); this.Root.Add (section); }
public DateTableViewSource() { mCells = new List<BasePickerCell>(); var aCell = new DatePickerCell(UIDatePickerMode.Date,DateTime.Now) { Key = "1234", }; aCell.TextLabel.Text = "Date"; aCell.RightLabelTextAlignment = UITextAlignment.Right; aCell.OnItemChanged += (object sender, PickerCellArgs e) => { var result = e.Items; }; mCells.Add(aCell); var someDict = new Dictionary<int,PickerViewCellComponent>(); someDict[0] = new PickerViewCellComponent() { Width = 160, Items = new List<PickerViewCellItem>() { new PickerViewCellItem() { SelectedValue = 1, DisplayValue = "Bob", }, new PickerViewCellItem() { SelectedValue = 2, DisplayValue = "John", }, } }; someDict[1] = new PickerViewCellComponent() { Width = 160, Items = new List<PickerViewCellItem>() { new PickerViewCellItem() { SelectedValue = 1, DisplayValue = "Dylan", }, new PickerViewCellItem() { SelectedValue = 2, DisplayValue = "Lennon", }, } }; // You can also use a string list for a single component // var aList = new List<String> (){ "Ringo", "John", "Paul", "George" }; // var pickerCell = new PickerViewCell(aList); var pickerCell = new PickerViewCell(someDict); pickerCell.TextLabel.Text = "Artist"; pickerCell.RightLabelTextAlignment = UITextAlignment.Right; pickerCell.SelectedObject = new object[]{1,1}; pickerCell.OnItemChanged += (object sender, PickerCellArgs e) => { var result = e.Items; }; mCells.Add(pickerCell); }
public DateTableViewSource() { formCells = new List<UITableViewCell>(); var aCell = new DatePickerCell(UIDatePickerMode.Time,DateTime.Now) { Key = "1234", }; aCell.TextLabel.Text = "Date"; aCell.RightLabelTextAlignment = UITextAlignment.Right; aCell.OnItemChanged += (object sender, PickerCellArgs e) => { var result = e.Items; }; var nameCell = new TextEntryCell(new NSString("name")){Label="Name"}; formCells.Add(nameCell); formCells.Add(aCell); }