当前位置: 首页>>代码示例>>C#>>正文


C# UIDatePicker类代码示例

本文整理汇总了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);
			
		}
开发者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


注:本文中的UIDatePicker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。