public override void ViewDidLoad ()
{
base.ViewDidLoad ();
dateFormatter = new NSDateFormatter ();
calendar = new XuniCalendar();
calendar.HeaderBackgroundColor = UIColor.White;
calendar.Hidden = true;
calendar.SelectionChanged+=(object sender, SelectionChangedEventArgs e) =>
{
dateFormatter.DateFormat = "M/d/yyyy";
dateLabel.Text = "The date " + dateFormatter.StringFor(e.SelectedDates.StartDate) + " was selected.";
calendar.Hidden = true;
if (calendar.Hidden == true) {
this.View.BackgroundColor = UIColor.White;
this.NavigationController.NavigationBar.BarTintColor = UIColor.White;
}
};
pickBtn = new UIButton(UIButtonType.System);
pickBtn.SetTitle("Pick a date", UIControlState.Normal);
pickBtn.TouchUpInside+=(object sender, EventArgs e) =>
{
calendar.Hidden = !calendar.Hidden;
if (calendar.Hidden == false) {
this.View.BackgroundColor = UIColor.Gray;
this.NavigationController.NavigationBar.BarTintColor = UIColor.LightGray;
}
else
{
this.View.BackgroundColor = UIColor.White;
this.NavigationController.NavigationBar.BarTintColor = UIColor.White;
}
};
dateLabel = new UILabel();
dateLabel.Text = "";
view = new UIView();
view.BackgroundColor = UIColor.White;
view.UserInteractionEnabled = true;
view.Layer.CornerRadius = 4;
this.View.Add(pickBtn);
this.View.Add(dateLabel);
this.View.Add(view);
this.View.Add(calendar);
}