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

C# Forms.Picker类代码示例

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

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



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

示例1: GenerateOptionLayout

        private ScrollView GenerateOptionLayout()
        {
            var stack = new StackLayout { Orientation = StackOrientation.Vertical };

            var peak = new Entry { Keyboard = Keyboard.Numeric, Placeholder = "Peak" };
            peak.SetBinding(Entry.TextProperty, OptionViewModel.PeakCommandPropertyName);
            stack.Children.Add(peak);

            var distance = new Entry { Keyboard = Keyboard.Numeric, Placeholder = "Distance" };
            distance.SetBinding(Entry.TextProperty, OptionViewModel.DistanceCommandPropertyName);
            stack.Children.Add(distance);

            var dogAllowed = new Switch();
            dogAllowed.SetBinding(Switch.IsToggledProperty, OptionViewModel.DogAllowedCommandPropertyName);
            stack.Children.Add(dogAllowed);

            var goodForKids = new Switch();
            goodForKids.SetBinding(Switch.IsToggledProperty, OptionViewModel.GoodForKidsCommandPropertyName);
            stack.Children.Add(goodForKids);

            var seasonStart = new Picker { Title = "SeasonStart" };
            foreach (var season in options.Seasons)
            {
                seasonStart.Items.Add(season.Value);
            }
            seasonStart.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.SeasonStartCommandPropertyName);
            stack.Children.Add(seasonStart);

            var seasonEnd = new Picker { Title = "SeasonEnd" };
            foreach (var season in options.Seasons)
            {
                seasonEnd.Items.Add(season.Value);
            }
            seasonEnd.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.SeasonEndCommandPropertyName);
            stack.Children.Add(seasonEnd);

            var trailType = new Picker() { Title = "Trail Type" };
            stack.Children.Add(trailType);
            foreach (var type in options.TrailsTypes)
            {
                trailType.Items.Add(type.Value);
            }
            trailType.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.TypeCommandPropertyName);

            var trailDurationType = new Picker() { Title = "Trail Duration Type" };
            foreach (var durType in options.TrailsDurationTypes)
            {
                trailDurationType.Items.Add(durType.Value);
            }
            trailDurationType.SetBinding(Picker.SelectedIndexProperty, OptionViewModel.DurationTypeCommandPropertyName);
            stack.Children.Add(trailDurationType);

            var button = GenericsContent.GenerateDefaultButton("Update");
            button.SetBinding(Button.CommandProperty, OptionViewModel.UpdateCommandPropertyName);
            stack.Children.Add(button);

            return new ScrollView { Content = stack };
        }
开发者ID:Zepsen,项目名称:App1,代码行数:58,代码来源:OptionPage.cs


示例2: App

        public App()
        {
            Picker pickerArrival = new Picker ();
            pickerArrival.Items.Add ("Android");
            pickerArrival.Items.Add ("iOS");
            pickerArrival.Items.Add ("Windows Phone");

            Button bt = new Button {
                Text = "Select OS",
            };

            bt.Clicked += (e, sender) => {
                Console.WriteLine ("Selected item: " + pickerArrival.Items [pickerArrival.SelectedIndex] +
                " - index: " + pickerArrival.SelectedIndex);
            };

            // The root page of your application
            MainPage = new ContentPage {
                Content = new StackLayout {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
                        pickerArrival,
                        bt
                    }
                }
            };
        }
开发者ID:NouriTj,项目名称:Xamarin,代码行数:27,代码来源:CustomPiker.cs


示例3: InitializeComponent

 private void InitializeComponent() {
     this.LoadFromXaml(typeof(MeasurementConverter));
     CfPicker = this.FindByName<Picker>("CfPicker");
     CfEntry = this.FindByName<Entry>("CfEntry");
     CtPicker = this.FindByName<Picker>("CtPicker");
     CtLabel = this.FindByName<Label>("CtLabel");
 }
开发者ID:MobileRez,项目名称:XFXamlClass,代码行数:7,代码来源:MeasurementConverter.xaml.g.cs


示例4: createList

        public static ViewCell createList(List<string> source, string Label)
        {
            Picker picker = new Picker
            {
                Title = Label,
                VerticalOptions = LayoutOptions.EndAndExpand
            };

            foreach (var item in source)
            {
                picker.Items.Add(item);
            }

            return new ViewCell()
            {
                View = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Spacing = 0,
                    Children = {
                       picker

                    }
                }
            };
        }
开发者ID:renatojuniorbh,项目名称:IconMasterDetail,代码行数:26,代码来源:Components.cs


示例5: JobCodeLayout

		public JobCodeLayout (List<ProjectCode> codes)
		{
			jobEntry = new Entry {
				Placeholder = "Enter job",
				Keyboard = Keyboard.Numeric,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			codePicker = new Picker {
				Title = "Select Code",
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			var billableCodes = codes;
			if (billableCodes.Any ()) {
				foreach (var x in billableCodes) {
					codePicker.Items.Add (x.code_ID);
				}
			} else {
				codePicker.Items.Add ("Default Code");
			}

			this.HorizontalOptions = LayoutOptions.FillAndExpand;
			this.Orientation = StackOrientation.Horizontal;
			this.Children.Add (jobEntry);
			this.Children.Add (codePicker);
		}
开发者ID:pablomferrari,项目名称:ETCTimeApp,代码行数:26,代码来源:JobCodeLayout.cs


示例6: networkedUI

		public void networkedUI(){
			var upSpeed = new Label
			{
				Text = "Update Speed",
				FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
				FontAttributes = FontAttributes.Bold,
			};

			picker = new Picker
			{
				VerticalOptions = LayoutOptions.Center
			};
			var data = DataManager.getInstance ();

			picker.SelectedIndexChanged += (sender, args) =>
			data.setUpdateSpeed (updateData [picker.SelectedIndex]);

			foreach (string datamember in updateData) {
				picker.Items.Add (datamember);
			}
			var stackLayout = new StackLayout ();
			stackLayout.Children.Add (settings);
			stackLayout.Children.Add (upSpeed);
			stackLayout.Children.Add (picker);
			Content = stackLayout;
			setSettings ();

		}
开发者ID:r0345,项目名称:EIMA,代码行数:28,代码来源:SettingsPage.cs


示例7: SetColors

 private void SetColors(Picker picker)
 {
     foreach (var color in Configurations.ColorNames)
     {
         picker.Items.Add(color);
     }
 }
开发者ID:sarahonorato,项目名称:Signature_PDF_Android,代码行数:7,代码来源:SignaturePadConfigView.xaml.cs


示例8: MultipleChoiceQuestion

		public MultipleChoiceQuestion ()
		{
			Title = "Multiple Choice";

			Label q1 = new Label{ Text = "Identify the visual field defect below." };

			var answers = new String[]{"Choose an option", "Bitemporal hemianopia", "Binasal hemianopia", "Central scotoma", "Right homonymous hemianopia", "Temporal homonymous hemianopia"};

			Picker q1a = new Picker ();

			foreach (var a in answers) {
				q1a.Items.Add (a);
			}

			var button = new Button {Text="Submit"};
			button.Clicked += (object sender, EventArgs e) =>  {
				if(q1a.SelectedIndex == 1){
					DisplayAlert("Correct!", "Well done, that's the right answer", "OK");
				}else{
					DisplayAlert("Incorrect", String.Format("The correct answer is {0}", answers[1]), "OK");
				}
			};

			Content = new StackLayout { 
				Children = {
					q1,
					new Image{
						Source = ImageSource.FromUri(new Uri("http://i.imgur.com/q7l03ZG.png"))
					},
					q1a,
					button
				}
			};
		}
开发者ID:JosephRedfern,项目名称:EyeZapApp,代码行数:34,代码来源:MultipleChoiceQuestion.cs


示例9: InitPicker

 internal void InitPicker(Picker picker)
 {
     foreach (string colorName in _nameToColor.Keys)
     {
         picker.Items.Add(colorName);
     }
 }
开发者ID:ahmedalejo,项目名称:XamlFormsGallery,代码行数:7,代码来源:PickerDemoViewModel.cs


示例10: InitializeComponent

 private void InitializeComponent() {
     this.LoadFromXaml(typeof(ExportPage));
     grid = this.FindByName<global::DevExpress.Mobile.DataGrid.GridControl>("grid");
     cbExportType = this.FindByName<Picker>("cbExportType");
     btnExport = this.FindByName<Button>("btnExport");
     txtPath = this.FindByName<Label>("txtPath");
     btnOpen = this.FindByName<Button>("btnOpen");
 }
开发者ID:RMDesenvolvimento,项目名称:Xamarin,代码行数:8,代码来源:DevExpress.GridDemo.Modules.ExportPage.xaml.g.cs


示例11: CompareSelectedIndex

        private bool CompareSelectedIndex(Picker myPicker, string name)
        {
            if (myPicker.SelectedIndex == -1)
                return false;


            return myPicker.Items[myPicker.SelectedIndex] == name;
        }
开发者ID:mgolois,项目名称:DivineChMS,代码行数:8,代码来源:NewMemberView.xaml.cs


示例12: InitializeComponent

 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(MunitConverter));
     startPicker = this.FindByName<Picker>("startPicker");
     startEntry = this.FindByName<Entry>("startEntry");
     endPicker = this.FindByName<Picker>("endPicker");
     endLabel = this.FindByName<Label>("endLabel");
 }
开发者ID:DanCaveman,项目名称:XFXamlClass,代码行数:8,代码来源:MunitConverter.xaml.g.cs


示例13: RaffleListPage

        // Can give some params default value later!!
        public RaffleListPage(bool isLocationDetected, IList<RaffleLocation> raffleLocations, RaffleLocation userSelectedLocation, GeonamesCountrySubdivision countrySubdivision, bool includeSocialMedia)
        {
            InitializeComponent();
            NavigationPage.SetHasBackButton(this, false);
            Title = "Raffle List";

            LocationDetected = isLocationDetected;
            IncludeSocialMedia = includeSocialMedia;
            _viewModel = new RaffleListViewModel(isLocationDetected, raffleLocations, userSelectedLocation, countrySubdivision);

            var locationPicker = new Picker();
            locationPicker.HorizontalOptions = LayoutOptions.Center;
            layout.Children.Add(locationPicker);

            locationPicker.Items.Add(_viewModel.LocationName);
            locationPicker.SelectedIndex = 0;
            locationPicker.IsEnabled = false;

            if (_viewModel.RaffleLocation == null) // only happen when locationDetected == true
            {
                layout.Children.Add(new StackLayout
                    {
                        Children =
                        { new Label
                            {
                                Text = "Sorry. There is no available raffle at your location.",
                                HorizontalOptions = LayoutOptions.CenterAndExpand,
                                VerticalOptions = LayoutOptions.CenterAndExpand,
                            }
                        },
                        Padding = new Thickness(20, 0, 20, 0),
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                    }
                );
            }
            else
            {
                GetRaffleEventsAndCreateList(_viewModel.LocationName);
            }

            // Previous UX
//            else
//            {
//                foreach (var location in raffleLocations)
//                {
//                    locationPicker.Items.Add(location.Name);
//                }
//                locationPicker.IsEnabled = true;
//                locationPicker.SelectedIndexChanged += (sender, e) =>
//                {
//                    if (layout.Children.Count == 2)
//                    {
//                        layout.Children.RemoveAt(1);
//                    }
//                    GetRaffleEventsAndCreateList(locationPicker.Items[locationPicker.SelectedIndex]);
//                };
//            }
        }
开发者ID:elschihyi,项目名称:Tap5050Buyer,代码行数:59,代码来源:RaffleListPage.xaml.cs


示例14: Settings

        public Settings()
        {
            Title = "Juego de Memoria";
            Icon = "house.png";

            StackLayout panel = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation = StackOrientation.Vertical,
                Spacing = 10,
                Padding = new Thickness(20, Device.OnPlatform(40, 20, 20), 20, 20),
            };

            Button start = new Button
            {
                Text = "Iniciar juego",
                TextColor = Color.White,
                BackgroundColor = Color.Green,
            };

            start.Clicked += delegate
            {
                App.Navigation.PushAsync(new GamePage(nivel, this.Width));
            };

            panel.Children.Add(new Label
            {
                Text = "Dificultad",
                TextColor = Color.Black,
            });

            var dificultad = new Picker
            {
                Title = "Dificultad",
            };
            dificultad.Items.Add("Fácil");
            dificultad.Items.Add("Normal");
            dificultad.SelectedIndex = 0;
            dificultad.SelectedIndexChanged += (sender, args) =>
            {
                nivel = dificultad.SelectedIndex;
            };

            panel.Children.Add(dificultad);
            panel.Children.Add(start);

            panel.Children.Add(new Label
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Text = "\n\n\nMemorama versión 1.0.0\nRafaelcNet 2014",
                Font = Font.SystemFontOfSize(18),
                TextColor = Color.Black,
            });

            Content = panel;

        }
开发者ID:palaniakasapu,项目名称:Xamarin,代码行数:58,代码来源:Settings.cs


示例15: GetSelectedItemPositionPicker

        public static StackLayout GetSelectedItemPositionPicker(FlexPie chart)
        {
            StackLayout stack = new StackLayout();

            stack.Orientation = StackOrientation.Horizontal;

            Label label = new Label();

            label.Text = "Selected Item Position";

            Picker picker = new Picker();

            picker.VerticalOptions = LayoutOptions.FillAndExpand;
            picker.HorizontalOptions = LayoutOptions.FillAndExpand;
            picker.Title = "Selected Item Position";

            picker.Items.Add("None");
            picker.Items.Add("Left");
            picker.Items.Add("Top");
            picker.Items.Add("Right");
            picker.Items.Add("Bottom");

            picker.SelectedIndex = 2;

            picker.SelectedIndexChanged += (e, sender) =>
            {
                Picker sentPicker = (Picker)e;

                ChartPositionType legendPoistion = ChartPositionType.Bottom;

                switch (sentPicker.SelectedIndex)
                {
                    case 0:
                        legendPoistion = ChartPositionType.None;
                        break;
                    case 1:
                        legendPoistion = ChartPositionType.Left;
                        break;
                    case 2:
                        legendPoistion = ChartPositionType.Top;
                        break;
                    case 3:
                        legendPoistion = ChartPositionType.Right;
                        break;
                    case 4:
                        legendPoistion = ChartPositionType.Bottom;
                        break;
                }

                chart.SelectedItemPosition = legendPoistion;
            };

            stack.Children.Add(label);
            stack.Children.Add(picker);

            return stack;

        }
开发者ID:techShubham,项目名称:Xamarin.Forms-Samples,代码行数:58,代码来源:Pickers.cs


示例16: LocationPickerPage

        LocationPickerPage(IRepository repo, IRace race)
        {
            // todo - summarise the race details
            Title = race.Code;

            Picker locationpicker = new Picker { WidthRequest = 300, Title = "Locations" };
            locationpicker.Items.Clear();
            repo.LocationList.Select(l => l.Name).ForEach (locationpicker.Items.Add);

            var entry = new Entry {Placeholder = "token"};

            var button = new Button { Text = "Go!", IsEnabled = false };

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            Func<bool> enable = () => (!string.IsNullOrEmpty(_token) && locationpicker.SelectedIndex >= 0 && !string.IsNullOrEmpty(locationpicker.Items[locationpicker.SelectedIndex]));

            entry.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                _token = entry.Text;
                button.IsEnabled = enable();
            };

            locationpicker.SelectedIndexChanged += (object sender, EventArgs e) =>
            {
                button.IsEnabled = enable();
            };

            button.Clicked += (object sender, EventArgs e) =>
            {
                IEnumerable<IBoat> boats = repo.BoatList;
                var location =
                    new LocationFactory()
                        .SetName(locationpicker.Items[locationpicker.SelectedIndex])
                        .SetToken(_token)
                        .SetItems(repo)
                        .Create();
                var tim = new TimingItemManager(new List<IRepository> { repo}, location, boats);
                var page = TimingMasterDetailPage.Create(tim);

                Navigation.PushAsync(page);
            };

            var dump = new Button { Text = "Dump", IsEnabled = true };
            dump.Clicked += (object sender, EventArgs e) =>
            {
                repo.Dump();
            };

            Content = new StackLayout {
                Children = {
                    locationpicker,
                    entry, button, dump
                }
            };
        }
开发者ID:unsliced,项目名称:head-race-management,代码行数:57,代码来源:LocationPickerPage.cs


示例17: InitializeComponent

 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(Home));
     grid = this.FindByName<Grid>("grid");
     SortByPicker = this.FindByName<Picker>("SortByPicker");
     TagsBtn = this.FindByName<Button>("TagsBtn");
     newsfeedScroll = this.FindByName<ScrollView>("newsfeedScroll");
     NewsSection = this.FindByName<StackLayout>("NewsSection");
 }
开发者ID:jarade,项目名称:IAB330Project,代码行数:9,代码来源:Home.xaml.g.cs


示例18: PickerDemoPage

        public PickerDemoPage()
        {
            Label header = new Label
            {
                Text = "Picker",
                Font = Font.BoldSystemFontOfSize(50),
                HorizontalOptions = LayoutOptions.Center
            };

            Picker picker = new Picker
            {
                Title = "Color",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            foreach (string colorName in nameToColor.Keys)
            {
                picker.Items.Add(colorName);
            }

            // Create BoxView for displaying picked Color
            BoxView boxView = new BoxView
            {
                WidthRequest = 150,
                HeightRequest = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            picker.SelectedIndexChanged += (sender, args) =>
                {
                    if (picker.SelectedIndex == -1)
                    {
                        boxView.Color = Color.Default;
                    }
                    else
                    {
                        string colorName = picker.Items[picker.SelectedIndex];
                        boxView.Color = nameToColor[colorName];
                    }
                };

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    picker,
                    boxView
                }
            };

        }
开发者ID:89sos98,项目名称:xamarin-forms-samples,代码行数:57,代码来源:PickerDemoPage.cs


示例19: InitializeComponent

 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(Contact_Us));
     content = this.FindByName<StackLayout>("content");
     emailAddress = this.FindByName<Entry>("emailAddress");
     problemPicker = this.FindByName<Picker>("problemPicker");
     subjectSection = this.FindByName<StackLayout>("subjectSection");
     respondSwitch = this.FindByName<Switch>("respondSwitch");
     refrerence = this.FindByName<StackLayout>("refrerence");
 }
开发者ID:jarade,项目名称:IAB330Project,代码行数:10,代码来源:Contact_Us.xaml.g.cs


示例20: InitializeComponents

		private async Task InitializeComponents()
		{
			products = await ProductService.Instance.ReadAll ();
			clients = await ClientService.Instance.ReadAll ();

			StackLayout layout = new StackLayout ();

			priceEntry = new Entry () { 
				Placeholder = "Precio",
				Keyboard = Keyboard.Numeric
			};

			layout.Children.Add ( priceEntry );

			quantityStepper = new Entry () {
				Placeholder = "Cantidad",
				Keyboard = Keyboard.Numeric
			};

			layout.Children.Add ( quantityStepper );

			detailsEditor = new Editor () {
				HeightRequest = 100,
				Text = "Detalles"
			};

			layout.Children.Add ( detailsEditor );

			productPicker = new Picker () {
				Title = "Elija un producto"
			};
			foreach( var p in products ) {
				productPicker.Items.Add ( p.Name );
			}
			layout.Children.Add ( productPicker );

			clientPicker = new Picker () { 
				Title = "Elija un cliente"
			};
			foreach( var c in clients ) {
				clientPicker.Items.Add ( c.Name );
			}
			layout.Children.Add ( clientPicker );

			orderButton = new CustomButton () { 
				Text = "Enviar",
				BackgroundImage = "blue-button-hi.png"
			};

			layout.Children.Add ( orderButton );

			Content = layout;

			orderButton.Clicked += OrderButton_Clicked;
		}
开发者ID:nchicas,项目名称:Combinado,代码行数:55,代码来源:PurchaseOrderPage.UI.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Forms.ScrollView类代码示例发布时间:2022-05-26
下一篇:
C# Forms.Page类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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