當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。