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


C# Picker.Unfocus方法代码示例

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


在下文中一共展示了Picker.Unfocus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NewPlayerPage

        public NewPlayerPage()
        {
            this.BindingContext = new FootballPlayerViewModel ();

            BackgroundColor = Color.FromHex ("#008080");
            Title = "Player Details";

            Entry Player_FName = new Entry {
                Placeholder = "First Name"
            };

            Entry Player_LName = new Entry {
                Placeholder = "Last Name"
            };

            DatePicker Date_of_Birth = new DatePicker {
                MaximumDate = DateTime.Now
            };

            Editor Description_Editor = new Editor ();

            string[] Country_Picker_array = new string[] {
                "Argentina", "Australia",
                "Belgium", "Brazil",
                "Canada", "China", "Croatia",
                "Denmark",
                "Ecuador", "Egypt", "El Salvador", "England", "Ethiopia",
                "Germany",
                "India", "Italy",
                "Japan",
                "Malasya",
                "Netherlands", "NewZealand",
                "Qatar",
                "South Africa"
            };

            Picker Country_Picker = new Picker ();

            foreach (string country_string in Country_Picker_array)
                Country_Picker.Items.Add (country_string);

            Button Save_Button = new Button {
                Text = "Save Details",
                BackgroundColor = Color.White,
                BorderRadius = 5,
                HorizontalOptions = LayoutOptions.Center
            };

            //Save_Button.Command = this.SetBinding (Button.CommandProperty,"SaveCommand");

            Save_Button.Clicked += (object sender, EventArgs e) => {

                Player_FName.Unfocus ();
                Player_LName.Unfocus ();
                Description_Editor.Unfocus ();
                Country_Picker.Unfocus ();
                Date_of_Birth.Unfocus ();

                if (Player_FName.Text == null || Player_LName.Text == null) {
                    DisplayAlert ("Warning", "Empty Player Name field", "Return");
                } else if (Country_Picker.SelectedIndex == -1) {
                    DisplayAlert ("Warning", "Empty Country field", "Return");
                } else if (Description_Editor.Text == null)
                    DisplayAlert ("Warning", "Empty Description field", "Return");
                else {

                    saveToDataBase (new FootballPlayer (
                        Player_FName.Text,
                        Player_LName.Text,
                        Date_of_Birth.Date.ToString("MMMM dd, yyyy"),
                        Country_Picker_array [Country_Picker.SelectedIndex],
                        Description_Editor.Text
                    ));

                }
            };

            StackLayout content_stacklayout = new StackLayout ();

            ScrollView Customer_Details_ScrollView = new ScrollView {
                WidthRequest = ((content_stacklayout.Width * 2) / 3),
                VerticalOptions = LayoutOptions.Center,
                Content = new StackLayout {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {

                        new Label {
                            Text = "Player Name :"
                        },
                        Player_FName,
                        Player_LName,
                        new Label {
                            Text = "Date of Birth :"
                        },
                        Date_of_Birth,
                        new Label {
                            Text = "Description :"
                        },
                        Description_Editor,
                        new Label {
//.........这里部分代码省略.........
开发者ID:ctsxamarintraining,项目名称:cts466856,代码行数:101,代码来源:NewPlayerPage.cs


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