• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UIPickerView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UIPickerView的典型用法代码示例。如果您正苦于以下问题:C# UIPickerView类的具体用法?C# UIPickerView怎么用?C# UIPickerView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UIPickerView类属于命名空间,在下文中一共展示了UIPickerView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetupPicker

        private void SetupPicker()
        {
            // Setup the picker and model
            PickerModel model = new PickerModel(this.colors);
            model.PickerChanged += (sender, e) => {
                this.selectedColor = e.SelectedValue;
            };

            UIPickerView picker = new UIPickerView();
            picker.ShowSelectionIndicator = true;
            picker.Model = model;

            // Setup the toolbar
            UIToolbar toolbar = new UIToolbar();
            toolbar.BarStyle = UIBarStyle.Black;
            toolbar.Translucent = true;
            toolbar.SizeToFit();

            // Create a 'done' button for the toolbar and add it to the toolbar
            UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
                                                             (s, e) => {
                this.ColorTextField.Text = selectedColor;
                this.ColorTextField.ResignFirstResponder();
            });
            toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);

            // Tell the textbox to use the picker for input
            this.ColorTextField.InputView = picker;

            // Display the toolbar over the pickers
            this.ColorTextField.InputAccessoryView = toolbar;
        }
开发者ID:13daysaweek,项目名称:MonoTouchUIPickerView,代码行数:32,代码来源:MonoTouchUIPickerViewViewController.cs


示例2: Selected

		public override void Selected (UIPickerView picker, int row, int component)
		{
			if (this.PickerChanged != null)
			{
				this.PickerChanged(this, new PickerChangedEventArgs{SelectedValue = values[row]});
			}
		}
开发者ID:rousse101,项目名称:WritePadSDK,代码行数:7,代码来源:xamarin_sampleViewController.cs


示例3: GetTitle

		public override string GetTitle (UIPickerView picker, int row, int component)
		{
			if(row == 0)
				return "Alle jegere";	
			else
				return JaktLoggApp.instance.JegerList[row-1].Navn;
		}
开发者ID:TheGiant,项目名称:Jaktloggen,代码行数:7,代码来源:FooterStatsArter.xib.cs


示例4: GetComponentWidth

 public override nfloat GetComponentWidth(UIPickerView picker, nint component)
 {
     if (component == 0)
         return 240f;
     else
         return 40f;
 }
开发者ID:newky2k,项目名称:PickerCells,代码行数:7,代码来源:SamplePickerViewModel.cs


示例5: Selected

		public override void Selected (UIPickerView pickerView, System.nint row, System.nint component)
		{
			SearchParameters.PartName = "";
			SearchParameters.Year = items [(int) row];
			selectedButton.Hidden = false;
			pickerView.Hidden = true;
		}
开发者ID:Cmaster14,项目名称:WilliesCycleApps,代码行数:7,代码来源:YearPickerViewModel.cs


示例6: ViewDidLoad

        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;


            var label = new ShapeLabel(new RectangleF(10, 10, 300, 40));
            Add(label);
            var textField = new UITextField(new RectangleF(10, 50, 300, 40));
            Add(textField);
            var shapeView = new ShapeView(new RectangleF(60, 90, 200, 200));
            Add(shapeView);

            var picker = new UIPickerView();
            var pickerViewModel = new MvxPickerViewModel(picker);
            picker.Model = pickerViewModel;
            picker.ShowSelectionIndicator = true;
            textField.InputView = picker;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(label).For(s => s.TheShape).To(vm => vm.Shape);
            set.Bind(textField).To(vm => vm.Shape);
            set.Bind(pickerViewModel).For(p => p.ItemsSource).To(vm => vm.List);
            set.Bind(pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Shape);
            set.Bind(shapeView).For(s => s.TheShape).To(vm => vm.Shape);
            set.Apply();

            var g = new UITapGestureRecognizer(() => textField.ResignFirstResponder());
            View.AddGestureRecognizer(g);
        }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:34,代码来源:FirstView.cs


示例7: 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


示例8: GetRowsInComponent

			public override nint GetRowsInComponent(UIPickerView pickerView, nint component)
			{
				if (component == 0)
					return tk.chartTypes.Length;
				else
					return tk.chartAnimation.Length;
			}
开发者ID:GoXuni,项目名称:Xamarin.iOS-Samples,代码行数:7,代码来源:LoadAnimationController.cs


示例9: GetTitle

		public override string GetTitle(UIPickerView uipv, int row, int component)
		{
			
			//each component would get its own title.			
			return columns[component][row];
			
		}
开发者ID:moljac,项目名称:MonoTouch.Samples,代码行数:7,代码来源:PickerModel.cs


示例10: 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


示例11: EnsureFilterPanelCreated

		void EnsureFilterPanelCreated()
		{
			if (null == _filterOptions)
			{
				_overlay = new UIView();
				_overlay.AddGestureRecognizer(new UITapGestureRecognizer(ToggleFilterPanel));
				_overlay.Frame = new RectangleF(PointF.Empty, View.Frame.Size);
				_filterOptions = new UIPickerView();
				_filterOptions.BackgroundColor = UIColor.White;
				_overlay.AddSubview(_filterOptions);
				_filterModel = new MvxPickerViewModel(_filterOptions);
				_filterModel.ItemsSource = new[] {
					"Alle",
					"Bøker",
					"CDer",
					"Filmer",
					"Journaler",
					"Lydbøker",
					"Noter",
					"Spill",
					"Annet"
				};
				_filterModel.SelectedItem = "Alle";
				_filterModel.SelectedItemChanged += HandleFilterChanged;
				_filterOptions.Model = _filterModel;
			}
		}
开发者ID:khellang,项目名称:Solvberget,代码行数:27,代码来源:SearchView.cs


示例12: GetView

        public override UIView GetView( UIPickerView pickerView, nint row, nint component, UIView view )
        {
            nfloat width = pickerView.RowSizeForComponent(component).Width;
            nfloat height = pickerView.RowSizeForComponent(component).Height;

            var pickerCustomView = new UIView {
                Frame = new CGRect(0, 0, width - 10, height)
            };
            var pickerImageView = new UIImageView {
                Frame = new CGRect(20, height/4, height/2, height/2)
            };
            var pickerViewLabel = new UILabel {
                Frame = new CGRect(20 + height, 0, width - 10, height)
            };

            pickerCustomView.AddSubview(pickerImageView);
            pickerCustomView.AddSubview(pickerViewLabel);

            Category category = CategoryHelper.AllCategories[(int) row];

            pickerImageView.Image = new UIImage(category.IconSource);
            pickerViewLabel.BackgroundColor = UIColor.Clear;
            pickerViewLabel.Text = category.Name;
            pickerViewLabel.TextColor = category.Color.ToUIColor();

            return pickerCustomView;
        }
开发者ID:strongloop,项目名称:loopback-example-xamarin,代码行数:27,代码来源:CategoryPickerDelegate.cs


示例13: SetupUserInterface

		private void SetupUserInterface ()
		{
			BackgroundColor = UIColor.Clear.FromHexString ("#094074", 1.0f);

			partNameLabel = new UILabel {
				Font = UIFont.FromName ("SegoeUI-Light", 32f),
				Frame = new CGRect (0, 0, this.Bounds.Width, 40),
				Text = "Choose a part.",
				TextAlignment = UITextAlignment.Center,
				TextColor = UIColor.White
			};

			partNameButton = new PickerButton {
				Frame = new CGRect (40, Frame.Height*1/8 + 10, this.Bounds.Width - 80, 30)
			};
			partNameButton.SetTitleColor (UIColor.Clear.FromHexString("#9B9B9B", 1.0f), UIControlState.Normal);

			searchButton = new SearchButton {
				Frame = new CGRect (40, Frame.Height*1/5 + 40, this.Bounds.Width - 80, 30)
			};
			searchButton.SetTitle ("Search", UIControlState.Normal);
			searchButton.SetTitleColor (UIColor.White, UIControlState.Normal);

			partNamePicker = new UIPickerView {
				Frame = new CGRect (0, Frame.Height*1/8, this.Bounds.Width, 40),
				Hidden = true,
			};

			buttonClickable = false;

			Add (partNameLabel);
			Add (partNameButton);
			Add (partNamePicker);
			Add (searchButton);
		}
开发者ID:Cmaster14,项目名称:WilliesCycleApps,代码行数:35,代码来源:PartNameView.cs


示例14: Selected

			/// <summary>
			/// called when a row is selected in the spinner
			/// </summary>
			public override void Selected (UIPickerView picker, nint row, nint component)
			{
				selectedIndex = (int)row;
				if (ValueChanged != null) {
					ValueChanged (this, new EventArgs ());
				}
			}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:10,代码来源:PickerView_CustomAppearance.cs


示例15: SetupUserInterface

		private void SetupUserInterface ()
		{
			BackgroundColor = UIColor.Clear.FromHexString ("#094074", 1.0f);

			makeLabel = new UILabel {
				Font = UIFont.FromName ("SegoeUI-Light", 32f),
				Frame = new CGRect (0, 0, Frame.Width, 40),
				Text = "Choose a make.",
				TextAlignment = UITextAlignment.Center,
				TextColor = UIColor.White
			};

			makeButton = new PickerButton {
				Frame = new CGRect (40, Frame.Height*1/8 + 10, Frame.Width - 80, 30)
			};
			makeButton.SetTitleColor (UIColor.Clear.FromHexString("#9B9B9B", 1.0f), UIControlState.Normal);

			makePicker = new UIPickerView {
				Frame = new CGRect (0, Frame.Height*1/8, Frame.Width, 40),
				Hidden = true,
				Model = new MakePickerViewModel (makeButton)
			};

			Add (makeLabel);
			Add (makeButton);
			Add (makePicker);
		}
开发者ID:Cmaster14,项目名称:WilliesCycleApps,代码行数:27,代码来源:MakeView.cs


示例16: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			string selectedColor = "";

			PickerModel model = new PickerModel();
			model.ValueChanged += (sender, e) => {
				selectedColor = model.SelectedItem;
			};

			UIPickerView picker = new UIPickerView();
			picker.ShowSelectionIndicator = false;
			picker.BackgroundColor = UIColor.White;
			picker.Model = model;

			this.color.Text = model.SelectedItem;

			UIToolbar toolbar = new UIToolbar();
			toolbar.BarStyle = UIBarStyle.Default;
			toolbar.Translucent = true;
			toolbar.SizeToFit();

			UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
				(s, e) => {
					this.color.Text = selectedColor;
					this.color.ResignFirstResponder();
				});
			toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);

			this.color.InputView = picker;

			this.color.InputAccessoryView = toolbar;
		}
开发者ID:mhalkovitch,项目名称:Xamarim,代码行数:34,代码来源:PickerExampleViewController.cs


示例17: GetTitle

 public override string GetTitle(UIPickerView picker, nint row, nint component)
 {
     if (row < 0 && row >= _values.Count)
     {
         return "Not found";
     }
     string title = String.Empty;
     switch (_pickerOption)
     {
         case PickerOptions.Courses:
             title = ((Course)_values[(int)row]).CourseTitle;
             break;
         //case PickerOptions.Banner:
         //    title = ((Banner)_values[(int)row]).BannerName;
         //    break;
         //case PickerOptions.Region:
         //    title = ((Region)_values[(int)row]).RegionName;
         //    break;
         //case PickerOptions.MonthOfYear:
         //    title = ((MonthOfYear)_values[(int)row]).MonthOfYearName;
         //    break;
         default:
             break;
     }
     return title;
 }
开发者ID:SergeiZag,项目名称:ContosoMobileAppMSA,代码行数:26,代码来源:PickerModel.cs


示例18: GetTitle

			public override string GetTitle(UIPickerView picker, nint row, nint component)
			{
				if (component == 0)
					return tk.pickerData[row];
				else
					return row.ToString();
			}
开发者ID:GoXuni,项目名称:Xamarin.iOS-Samples,代码行数:7,代码来源:ThemingController.cs


示例19: GetTitle

			public override string GetTitle(UIPickerView picker, nint row, nint component)
			{
				if (component == 0)
					return tk.chartTypes[row];
				else
					return tk.chartAnimation[row];
			}
开发者ID:GoXuni,项目名称:Xamarin.iOS-Samples,代码行数:7,代码来源:LoadAnimationController.cs


示例20: Selected

		public virtual void Selected(UIPickerView picker, int row, int component) {
			var countryName = this.Countries[row];
			var featureLayer = (AGSFeatureLayer)this.MapView.MapLayerForName("CloudData");

			if (featureLayer.SelectionSymbol == null) {
				// SYMBOLOGY FOR WHERE CLAUSE SELECTION
				var selectedFeatureSymbol = AGSSimpleMarkerSymbol.SimpleMarkerSymbolWithColor(UIColor.FromRGBA(0.78f, 0.3f, 0.19f, 1f));
				selectedFeatureSymbol.Style = AGSSimpleMarkerSymbolStyle.Circle;
				selectedFeatureSymbol.Size = new SizeF(10, 10);
				featureLayer.SelectionSymbol = selectedFeatureSymbol;
			}

			if (featureLayer.WeakQueryDelegate == null) {
				featureLayer.WeakQueryDelegate = this;
			}

			if (countryName == "None") {
				// CLEAR SELECTION
				featureLayer.ClearSelection();
			}
			else {
				var selectQuery = AGSQuery.Query();
				selectQuery.Where = string.Format("COUNTRY = '{0}'", countryName);
				featureLayer.SelectFeaturesWithQuery(selectQuery, AGSFeatureLayerSelectionMethod.New);
			}

			// Dismiss action sheet
			var pickerSheet = (UIActionSheet)picker.Superview;
			pickerSheet.DismissWithClickedButtonIndex(0, true);
		}
开发者ID:huashihongfeng,项目名称:MonoTouch.ArcGIS,代码行数:30,代码来源:ViewController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UIPopoverController类代码示例发布时间:2022-05-24
下一篇:
C# UIPanelBase类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap