本文整理汇总了C#中Entry.Unfocus方法的典型用法代码示例。如果您正苦于以下问题:C# Entry.Unfocus方法的具体用法?C# Entry.Unfocus怎么用?C# Entry.Unfocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry.Unfocus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 {
//.........这里部分代码省略.........
示例2: App
public App()
{
var map = new MapExtend()
{
IsShowingUser = true,
HeightRequest = 100,
WidthRequest = 960,
VerticalOptions = LayoutOptions.FillAndExpand
};
var entryEnd = new Entry
{
Placeholder = "Address",
HorizontalOptions = LayoutOptions.FillAndExpand
};
var btnSearch = new Button
{
Text = "Add",
BackgroundColor = Color.Transparent,
BorderColor = Color.Transparent
};
var btnCreateRoute = new Button
{
Text = "Route",
BackgroundColor = Color.Transparent,
BorderColor = Color.Transparent
};
var barItens = new StackLayout
{
Orientation = StackOrientation.Horizontal
};
btnSearch.Clicked += async (sender, args) =>
{
await map.SearchAdress(entryEnd.Text).ContinueWith(t =>
{
var d = t;
});
entryEnd.Text = string.Empty;
entryEnd.Unfocus();
};
barItens.Children.Add(entryEnd);
barItens.Children.Add(btnSearch);
btnCreateRoute.Clicked += async (sender, args) =>
{
await map.CreateRoute(map.Pins[0].Position, map.Pins[1].Position).ContinueWith(t =>
{
var d = t;
});
};
var btnNearbyLocation = new Button
{
Text = "Nearby Pleaces"
};
btnNearbyLocation.Clicked += async (sender, args) =>
{
await map.NearbyLocations("AIzaSyBuATAkE41ioaMXd6MvWOmFlG2p-MlE6HM", "").ContinueWith(t =>
{
var d = t;
});
};
var stack = new StackLayout
{
Spacing = 0,
Children = { barItens, map, btnCreateRoute, btnNearbyLocation }
};
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
var geoLocation = locator.GetPositionAsync().ContinueWith(t =>
{
if (t.IsFaulted)
{
//System.Diagnostics.Debug.WriteLine("Error : {0}", ((GeolocationException)t.Exception.InnerException).Error.ToString());
}
else if (t.IsCanceled)
{
System.Diagnostics.Debug.WriteLine("Error : The geolocation has got canceled !");
}
else
{
var currentLocation = new Position(t.Result.Latitude, t.Result.Longitude);
Device.BeginInvokeOnMainThread(() =>
{
map.MoveToRegion(MapSpan.FromCenterAndRadius(currentLocation, Xamarin.Forms.Maps.Distance.FromMiles(0.5)));
map.EPins.Add(new PinExtend{ Name= "seu endereço", Location= currentLocation, Details = "seu endreço", ResourceNameImg = "icon" });
});
//.........这里部分代码省略.........