本文整理汇总了C#中UIDatePicker类的典型用法代码示例。如果您正苦于以下问题:C# UIDatePicker类的具体用法?C# UIDatePicker怎么用?C# UIDatePicker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIDatePicker类属于命名空间,在下文中一共展示了UIDatePicker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:bpug,项目名称:LbkIos,代码行数:29,代码来源:ReservierungViewController.cs
示例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;
}
开发者ID:mhalkovitch,项目名称:Xamarim,代码行数:28,代码来源:DatePickerExampleViewController.cs
示例3: Include
public void Include (UIDatePicker date)
{
date.Date = date.Date.AddSeconds (1);
date.ValueChanged += (sender, args) => {
date.Date = (Foundation.NSDate)DateTime.MaxValue;
};
}
开发者ID:jonstoneman,项目名称:MvvmCross-Samples,代码行数:7,代码来源:LinkerPleaseInclude.cs
示例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);
}
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:7,代码来源:MvxUIDatePickerTimeTargetBinding.cs
示例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;
}
开发者ID:MobiusGen,项目名称:Animal-Care-iOS,代码行数:26,代码来源:SettingsController.cs
示例6: CreatePicker
public virtual UIDatePicker CreatePicker ()
{
var picker = new UIDatePicker (RectangleF.Empty){
AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
Mode = UIDatePickerMode.DateAndTime,
Date = DateValue
};
return picker;
}
开发者ID:henrikweimenhog,项目名称:MonoTouch.Dialog,代码行数:9,代码来源:DateTimeElement.cs
示例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);
}
开发者ID:CVertex,项目名称:monotouch-samples,代码行数:10,代码来源:PickerViewController.xib.cs
示例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;
}
开发者ID:rmawani,项目名称:XamDialogs,代码行数:14,代码来源:XamDatePickerDialog.cs
示例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);
}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:11,代码来源:PickerViewController.xib.cs
示例10: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.SetStyleClass("sample-background");
_datePicker = new UIDatePicker();
_datePicker.SetStyleId("sample-date");
View.AddSubview(_datePicker);
}
开发者ID:jamilgeor,项目名称:Crayon,代码行数:12,代码来源:UIDatePickerExample.cs
示例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);
}
开发者ID:CheezeCoder,项目名称:AaronBratcher_TableViewHelper_Xamarin,代码行数:19,代码来源:DatePickerCell.cs
示例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;
}
开发者ID:holisticware-admin,项目名称:MonoVersalSharpSerializer,代码行数:13,代码来源:FormSimpleSample.cs
示例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;
}
开发者ID:nagyist,项目名称:MonoKit,代码行数:17,代码来源:UIDateField.cs
示例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;
}
开发者ID:guivho,项目名称:DatePickerTest,代码行数:18,代码来源:Main.cs
示例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;
}
开发者ID:hisystems,项目名称:MonoTouch.Dialog,代码行数:18,代码来源:DatePopoverRootElement.cs
示例16: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
var textView = new UITextField(new CGRect(10, 90, 300, 30));
Add(textView);
var datePicker = new UIDatePicker();
datePicker.Mode = UIDatePickerMode.Date;
textView.InputView = datePicker;
var label = new UILabel(new CGRect(10, 120, 300, 30));
Add(label);
var set = this.CreateBindingSet<DateTimeView, DateTimeViewModel>();
set.Bind(datePicker).To(vm => vm.Property);
set.Bind(textView).To("Format('{0:dd MMM yyyy}', Property)");
set.Bind(label).To("Format('{0:dd MMM yyyy}', Property)");
set.Apply();
}
开发者ID:jonstoneman,项目名称:MvvmCross-Samples,代码行数:18,代码来源:FirstView.cs
示例17: UpdateCell
public override void UpdateCell(UITableViewCell cell, NSIndexPath indexPath)
{
base.UpdateCell(cell, indexPath);
cell.Accessory = UITableViewCellAccessory.None;
cell.TextLabel.Text = Caption;
DatePicker = CreatePicker();
var view = new UIView(DatePicker.Bounds) { BackgroundColor = UIColor.Black };
view.AddSubview(DatePicker);
Control = DatePicker;
InputView.InputView = view;
InputView.InputAccessoryView = new UIDatePickerToolbar(this) { };
if (cell.DetailTextLabel != null)
cell.DetailTextLabel.Text = FormatDate(DatePicker.Date.ToDateTime());
}
开发者ID:drony,项目名称:MonoMobile.Views,代码行数:19,代码来源:DateTimeCellView.cs
示例18: CreateToolbarItems
public override UIBarButtonItem[] CreateToolbarItems()
{
var caption = "Today";
_DatePicker = FocusableView.Control as UIDatePicker;
if(_DatePicker != null)
{
if (_DatePicker.Mode == UIDatePickerMode.Time)
caption = "Now";
}
var baseButtons = base.CreateToolbarItems();
_TodayButton = new UIBarButtonItem(caption, UIBarButtonItemStyle.Bordered, Today);
var buttonList = baseButtons.ToList();
buttonList.Insert(2, _TodayButton);
return buttonList.ToArray();
}
开发者ID:drony,项目名称:MonoMobile.Views,代码行数:20,代码来源:UIDatePickerToolbar.cs
示例19: DatePickerPopover
public DatePickerPopover(UIView owner)
{
this.Owner = owner;
this.datePicker = new UIDatePicker();
this.datePicker.Frame = new RectangleF(0, 44, 320, 216);
var popoverContent = new UIViewController(); //ViewController
var popoverView = new UIView
{
BackgroundColor = UIColor.Black
}; //view
popoverView.AddSubview(this.DatePicker);
popoverContent.View = popoverView;
popoverController = new UIPopoverController(popoverContent);
popoverController.Delegate=this;
popoverController.SetPopoverContentSize(new SizeF(320, 264), false);
}
开发者ID:DnyaneshwarWadghanePM,项目名称:notes-for-nurses-redux,代码行数:20,代码来源:DatePickerPopover.cs
示例20: UIDateTextField
public UIDateTextField(IntPtr handle)
: base(handle)
{
datePicker = new UIDatePicker();
dateFormatter = new NSDateFormatter();
dateFormatter.DateStyle = NSDateFormatterStyle.Long;
// Set up the date picker
datePicker.Mode = UIDatePickerMode.Date;
datePicker.MinimumDate = DateTime.Today.AddMonths (-2);
datePicker.MaximumDate = DateTime.Today;
datePicker.ValueChanged += (s, e) => {
this.Text = dateFormatter.ToString((s as UIDatePicker).Date);
this._currentDate = DateTime.SpecifyKind((s as UIDatePicker).Date, DateTimeKind.Unspecified);
};
// Setup the dateToolbar
UIToolbar dateToolbar = new UIToolbar();
dateToolbar.BarStyle = UIBarStyle.Black;
dateToolbar.Translucent = true;
dateToolbar.SizeToFit();
// Create a 'done' button for the dateToolbar
UIBarButtonItem dateDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => {
this.ResignFirstResponder();
});
// Create flexible space
UIBarButtonItem dateFlex = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
// Add button and dateFlexible space to the dateToolbar
dateToolbar.SetItems(new UIBarButtonItem[]{dateFlex, dateDoneButton}, true);
this.InputView = datePicker;
this.InputAccessoryView = dateToolbar;
}
开发者ID:bertouttier,项目名称:ExpenseApp-Mono,代码行数:39,代码来源:UIDateTextField.cs
注:本文中的UIDatePicker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论