所以,我是Xamarin的新手,我正在试图弄清楚如何显示一个包含用户文本输入字段的弹出窗口.DisplayAlert没有这样做,因为它没有文本输入字段.我该怎么用?
我和Xamarin一起工作,还是新手,但是我遇到了一个问题,我觉得我不应该这样做.这是我的问题:
using System;
using Xamarin.Forms;
namespace DataBinding_Lists
{
public class App
{
public static Page GetMainPage ()
{
var listView = new ListView { RowHeight = 40 };
listView.ItemsSource = new Person []
{
new Person { FirstName = "Abe", LastName = "Lincoln" },
new Person { FirstName = "Groucho", LastName = "Marks" },
new Person { FirstName = "Carl", LastName = "Marks" },
};
listView.ItemTemplate = new DataTemplate(typeof(TextCell));
listView.ItemTemplate.SetBinding(TextCell.TextProperty, "FirstName");
listView.ItemSelected += async (sender, e) => {
await DisplayAlert …Run Code Online (Sandbox Code Playgroud) 在C#中,我可以说:
int myInt = 10;
int myInt2 = 20;
Console.WriteLine("My Integer equals {0}, and the other one equals {1}", myInt, myInt2);
Run Code Online (Sandbox Code Playgroud)
而且我知道如何用Java打印这样的东西:
int myInt = 10;
System.out.println("My Integer equals " + myInt);
Run Code Online (Sandbox Code Playgroud)
那么如何将这两者结合起来,以便在Java中,我可以像在C#中一样打印多个值?
这只是一个简化的示例,但我正在尝试将其设置为当我在应用程序中打开此页面时,首先发生的是键盘弹出,以便用户输入对条目的响应领域.
var namelabel = new Label { Text = "What is your name?" };
var nameentry = new Entry { Placeholder = "Type here..." };
var colorlabel = new Label { Text = "What's your fav color?" };
var colorentry = new Entry { Placeholder = "Type here..." };
Content = new StackLayout {
Spacing = 15,
Children = { namelabel, nameentry, colorlabel, colorentry }
};
Run Code Online (Sandbox Code Playgroud)
如何将页面焦点设置为第一个条目?此外,在用户输入第一个条目后,我怎么能设置它,以便用户可以按下键盘上的"下一个"按钮(或沿着这些线条的东西),应用程序将带他们填写第二次入场?