本文整理汇总了C#中UIDatePicker类的典型用法代码示例。如果您正苦于以下问题:C# UIDatePicker类的具体用法?C# UIDatePicker怎么用?C# UIDatePicker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIDatePicker类属于命名空间,在下文中一共展示了UIDatePicker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
void Initialize ()
{
Title = Locale.GetText ("Reservierung");
ServiceAgent.Current.ServiceClient.CreateReservationByObjectCompleted += this.HandleReservationCompleted;
/*
_hud = new LoadingHUDView (){
//HudBackgroundColor = Resources.Colors.BackgroundHUD,
ShowRoundedRectangle = true
};
*/
_reservationDatePicker = new UIDatePicker ();
_reservationDatePicker.Locale = NSLocale.CurrentLocale;
_reservationDatePicker.TimeZone = NSTimeZone.FromAbbreviation ("GMT"); //NSTimeZone.LocalTimeZone;
_reservationDatePicker.ValueChanged += delegate {
this.txtDate.Text = _reservationDatePicker.Date.ToDateTime().ToLongDateTimeString();
};
var seatsModel = new SeatsPickerModel (MAX_SEATS);
_seatsPicker = new UIPickerView (){
Model = seatsModel,
ShowSelectionIndicator = true,
};
seatsModel.ValueChanged += delegate(object sender, EventArgs<int> e) {
txtSeats.Text = e.Value.ToString ();
};
_seatsPicker.Frame = new RectangleF (_seatsPicker.Frame.X, _seatsPicker.Frame.Y, _seatsPicker.Frame.Width, 80f);
}
示例2: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
UIDatePicker datePicker = new UIDatePicker ();
datePicker.Mode = UIDatePickerMode.Date;
datePicker.BackgroundColor = UIColor.White;
datePicker.MinimumDate = DateTime.Today.AddDays(-7);
datePicker.MaximumDate = DateTime.Today.AddDays(7);
UIToolbar toolbar = new UIToolbar();
toolbar.BarStyle = UIBarStyle.Default;
toolbar.Translucent = true;
toolbar.SizeToFit();
UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
(s, e) => {
DateTime dateTime = DateTime.SpecifyKind(datePicker.Date, DateTimeKind.Unspecified);
this.textField.Text = dateTime.ToString("MM-dd-yyyy");
this.textField.ResignFirstResponder();
});
toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);
this.textField.InputAccessoryView = toolbar;
textField.InputView = datePicker;
}
示例3: Include
public void Include (UIDatePicker date)
{
date.Date = date.Date.AddSeconds (1);
date.ValueChanged += (sender, args) => {
date.Date = (Foundation.NSDate)DateTime.MaxValue;
};
}
示例4: GetValueFrom
protected override object GetValueFrom(UIDatePicker view)
{
var components = NSCalendar.CurrentCalendar.Components(
NSCalendarUnit.Hour | NSCalendarUnit.Minute | NSCalendarUnit.Second,
view.Date);
return new TimeSpan((int)components.Hour, (int)components.Minute, (int)components.Second);
}
示例5: SettingsTableSource
public SettingsTableSource(UITableViewController controller, string cellID)
{
this.cellID = cellID;
this.controller = controller;
// Set up the NSDateFormatter
this.dateFormatter = new NSDateFormatter();
this.dateFormatter.DateStyle = NSDateFormatterStyle.None;
this.dateFormatter.TimeStyle = NSDateFormatterStyle.Short;
// Set up the UIDatePicker
this.timePicker = new UIDatePicker();
timePicker.Mode = UIDatePickerMode.Time;
timePicker.Date = NSDate.Now;
timePicker.Hidden = true;
this.timePickerIsShowing = false;
this.dayPickerDay = 1;
this.dayPickerUnit = "Days";
// Set up the UIPickerView
this.dayPicker = new UIPickerView();
this.dayPicker.DataSource = new DayPickerSource();
this.dayPicker.Delegate = new DayPickerDelegate(this);
this.dayPicker.Hidden = true;
this.dayPickerIsShowing = false;
}
示例6: CreatePicker
public virtual UIDatePicker CreatePicker ()
{
var picker = new UIDatePicker (RectangleF.Empty){
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
Mode = UIDatePickerMode.DateAndTime,
Date = DateValue
};
return picker;
}
示例7: CreateDatePicker
public void CreateDatePicker()
{
datePickerView = new UIDatePicker (RectangleF.Empty) {
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
Mode = UIDatePickerMode.Date,
Hidden = true
};
datePickerView.Frame = PickerFrameWithSize (datePickerView.SizeThatFits (SizeF.Empty));
View.AddSubview (datePickerView);
}
示例8: XamDatePickerDialog
/// <summary>
/// Initializes a new instance of the <see cref="XamDialogs.DHDatePickerDialog"/> class.
/// </summary>
/// <param name="mode">Mode.</param>
public XamDatePickerDialog (UIDatePickerMode mode)
: base(XamDialogType.DatePicker)
{
mDatePicker = new UIDatePicker (CGRect.Empty);
mDatePicker.Mode = mode;
mDatePicker.TimeZone = NSTimeZone.LocalTimeZone;
mDatePicker.Calendar = NSCalendar.CurrentCalendar;
mDatePicker.ValueChanged += OnValueChanged;
}
示例9: CreateDatePicker
public void CreateDatePicker()
{
datePickerView = new UIDatePicker (CGRect.Empty) {
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
Mode = UIDatePickerMode.Date,
BackgroundColor = backgroundColor,
Hidden = true
};
datePickerView.Frame = PickerFrameWithSize (datePickerView.SizeThatFits (CGSize.Empty));
View.AddSubview (datePickerView);
}
示例10: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.SetStyleClass("sample-background");
_datePicker = new UIDatePicker();
_datePicker.SetStyleId("sample-date");
View.AddSubview(_datePicker);
}
示例11: initCell
//========================================================================================================================================
// PUBLIC METHODS
//========================================================================================================================================
//========================================================================================================================================
// PRIVATE METHODS
//========================================================================================================================================
private void initCell()
{
this._datePicker = new UIDatePicker ();
this._datePicker.Mode = UIDatePickerMode.DateAndTime;
this._datePicker.ValueChanged += (object sender, EventArgs e) => {
DateUpdateArgs dua = new DateUpdateArgs();
Foundation.NSDateFormatter Dformatter = new Foundation.NSDateFormatter();
Dformatter.DateFormat = "MMM dd', 'YYYY' 'HH:mm";
dua.Date = Dformatter.ToString(this._datePicker.Date);
this.didUpdateDatePicker(sender, dua);
};
this.AddSubview (_datePicker);
}
示例12: DateChooser
void DateChooser()
{
UIDatePicker datePicker = new UIDatePicker();
datePicker.ValueChanged += (object sender, EventArgs e) =>
{
dateTimePicker1.Text = datePicker.Date.ToString();
};
dateTimePicker1.InputView = datePicker;
dateTimePicker1.InputAccessoryView = datePickerDismissalView(datePicker,dateTimePicker1);
return;
}
示例13: UIDateField
public UIDateField(RectangleF frame) : base(frame)
{
this.dateFormat = "D";
this.picker = new UIDatePicker();
this.picker.Mode = UIDatePickerMode.Date;
this.picker.TimeZone = NSTimeZone.FromAbbreviation("GMT");
this.picker.ValueChanged += this.PickerValueChanged;
this.label = new UILabel(this.Bounds);
this.label.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleLeftMargin;
this.label.BackgroundColor = UIColor.Clear;
this.label.UserInteractionEnabled = false;
this.AddSubview(this.label);
this.Date = DateTime.Today;
}
示例14: FinishedLaunching
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
var vc = new UIViewController ();
dp = new UIDatePicker ();
dp.Mode = UIDatePickerMode.Date;
dp.Mode = UIDatePickerMode.DateAndTime;
dp.Mode = UIDatePickerMode.Time;
dp.ValueChanged += delegate {
Console.WriteLine (dp.Date.ToString ());
};
vc.View.AddSubview (dp);
window.AddSubview (vc.View);
window.MakeKeyAndVisible ();
return true;
}
示例15: MakeViewController
protected override UIViewController MakeViewController()
{
this.datePicker = new UIDatePicker();
this.datePicker.Mode = UIDatePickerMode.Date;
this.datePicker.Date = (NSDate)DateTime.SpecifyKind(initialDate, DateTimeKind.Local);
var pickerViewController = new UIViewController();
pickerViewController.Title = "Date";
pickerViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (sender, e) => Cancel());
pickerViewController.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (sender, e) => Done());
pickerViewController.View = this.datePicker;
var navigationController = new UINavigationController();
navigationController.PreferredContentSize = this.datePicker.IntrinsicContentSize;
navigationController.PushViewController(pickerViewController, animated: false);
return navigationController;
}