本文整理汇总了C#中Xamarin.Forms.Button.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Focus方法的具体用法?C# Button.Focus怎么用?C# Button.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xamarin.Forms.Button
的用法示例。
在下文中一共展示了Button.Focus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateUI
//.........这里部分代码省略.........
cruiseControlPicker.Items.Add(i);
}
cruiseControlPicker.SelectedIndexChanged += (sender, args) =>
{
if (cruiseControlPicker.SelectedIndex == 0)
car.CruiseControl = false;
else
car.CruiseControl = true;
Debug.WriteLine("Cruise Control " + car.CruiseControl);
};
// ----------------------------
trimLabel.Text = "Which Trim?";
trimLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText);
List<string> trimList = new List<string> { "LE", "XLE", "SE", "Special Edition", "XSE", "Hybrid LE", "Hybrid SE", "Hybrid XLE" };
foreach (string i in trimList)
{
trimPicker.Items.Add(i);
}
trimPicker.SelectedIndexChanged += (sender, args) =>
{
car.Trim = trimList.ElementAt(trimPicker.SelectedIndex);
Debug.WriteLine("Trim: " + car.Trim);
};
// ----------------------------
warrantyLabel.Text = "Warranty Package";
warrantyLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText);
List<string> warrantyList = new List<string> { "Standard", "Premium 100k 10 Year" };
foreach (string i in warrantyList)
{
warrantyPicker.Items.Add(i);
}
warrantyPicker.SelectedIndexChanged += (sender, args) =>
{
if (warrantyPicker.SelectedIndex == 0)
car.WarrantyProgramType = "Standard";
else
car.WarrantyProgramType = "Premium 100k 10 Year";
Debug.WriteLine("Warranty: " + car.WarrantyProgramType);
};
// ----------------------------
rearBrakeStyleLabel.Text = "Rear Brake Type";
rearBrakeStyleLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText);
List<string> brakeList = new List<string> { "Drum", "Disk" };
foreach (string i in brakeList)
{
rearBrakeStylePicker.Items.Add(i);
}
rearBrakeStylePicker.SelectedIndexChanged += (sender, args) =>
{
if (rearBrakeStylePicker.SelectedIndex == 0)
car.RearBrakes = "Drum";
else
car.RearBrakes = "Disk";
Debug.WriteLine("Rear Brake Type: " + car.RearBrakes);
};
// ----------------------------
frontBrakeStyleLabel.Text = "Front Brake Type";
frontBrakeStyleLabel.TextColor = Color.FromHex(ThemeColors.PrimaryText);
foreach (string i in brakeList)
{
frontBrakeStylePicker.Items.Add(i);
}
frontBrakeStylePicker.SelectedIndexChanged += (sender, args) =>
{
if (frontBrakeStylePicker.SelectedIndex == 0)
car.FrontBrakes = "Drum";
else
car.FrontBrakes = "Disk";
Debug.WriteLine("Front Brake Type: " + car.FrontBrakes);
};
orderCarButton.Clicked += async (sender, e) => {
car.DeliveryDateToNewDealer = DateTime.Now;;
activityIndicator.IsRunning = true;
activityIndicator.IsVisible = true;
orderCarButton.IsEnabled = false;
await AddItem(car);
activityIndicator.IsVisible = false;
activityIndicator.IsRunning = false;
orderCarConfirmation.Text = "Car Ordered. VIN#: " + car.VIN;
orderCarConfirmationInstruction.Text = "Please write down number for reference";
orderCarConfirmation.IsVisible = true;
orderCarConfirmationInstruction.IsVisible = true;
stackLayout.BackgroundColor = Color.FromHex (ThemeColors.TextIcons);
OrderedStack.BackgroundColor = Color.FromHex (ThemeColors.PrimaryDark);
orderCarConfirmation.BackgroundColor = Color.FromHex (ThemeColors.PrimaryDark);
orderCarConfirmationInstruction.BackgroundColor = Color.FromHex (ThemeColors.PrimaryDark);
orderCarConfirmation.TextColor = Color.FromHex (ThemeColors.Accent);
orderCarConfirmation.FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label));
orderCarConfirmationInstruction.TextColor = Color.FromHex (ThemeColors.TextIcons);
orderCarConfirmationInstruction.FontSize = Device.GetNamedSize (NamedSize.Micro, typeof(Label));
orderCarButton.Focus ();
};
}
示例2: NewSurveyPage
public NewSurveyPage (string CID)
{
//InitializeComponent ();
this.Padding = new Thickness (20, 20, 20, 5);
if (Device.OS == TargetPlatform.Android)
{
NavigationPage.SetTitleIcon (this, "opac.png");
BackgroundColor = Color.FromHex ("#2A2A2A");
}
cid = CID;
Label titleLabel = new Label
{
Text = "Create new Survey",
FontAttributes = FontAttributes.Bold,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.StartAndExpand
};
editor = new Editor
{
Text = "Please insert the question here\n\n\n",
HorizontalOptions = LayoutOptions.Fill
};
if (Device.OS == TargetPlatform.WinPhone)
{
editor.BackgroundColor = Color.White;
}
Label optionsLabel = new Label
{
Text = "Options/Answers",
HorizontalOptions = LayoutOptions.CenterAndExpand
};
//TODO: allow dynmic adding of options for the survey!
e1 = new Entry { Text = "Option/Answer 1" };
e1.Completed += (o, s) => { e2.Focus(); };
e2 = new Entry { Text = "Option/Answer 2" };
e2.Completed += (o, s) => { e3.Focus(); };
e3 = new Entry { Text = "" };
e3.Completed += (o, s) => { e4.Focus(); };
e4 = new Entry { Text = "" };
Button createButton = new Button
{
Text = "Create Survey",
HorizontalOptions = LayoutOptions.CenterAndExpand,
};
createButton.Clicked += createButton_Clicked;
e4.Completed += (o, s) => { createButton.Focus(); };
StackLayout stack = new StackLayout
{
Orientation = StackOrientation.Vertical,
Spacing = 30,
Children = { titleLabel, editor, optionsLabel, e1, e2, e3, e4, createButton },
VerticalOptions = LayoutOptions.Fill
};
Padding = new Thickness(15, 10, 15, 5);
ScrollView scroll = new ScrollView { Content = stack };
Content = scroll;
}