我在Xamarin.Forms中实现了我自己的WrapLayout
。现在页面的构造函数中的DisplayAlert
没有显示任何内容。DisplayAlert()不在自定义布局中显示
public WrapLayoutExtendedPage()
{
InitializeComponent();
wrapLayoutExtended.Children.Add(new CustomLabel() { Text = "Label 1 Test", WidthRequest = 500, BackgroundColor = Color.Green, Length = 3 });
wrapLayoutExtended.Children.Add(new CustomEntry() { WidthRequest = 900, BackgroundColor = Color.Red, Length = 9, InsertBreakAfter = true });
wrapLayoutExtended.Children.Add(new CustomLabel() { Text = "Label 2 Test", WidthRequest = 500, BackgroundColor = Color.Green, Length = 5 });
wrapLayoutExtended.Children.Add(new CustomEntry() { WidthRequest = 900, BackgroundColor = Color.Red, Length = 7, InsertBreakAfter = true });
DisplayAlert("TEST", "TEST", "OK");
}
没有例外或什么。我试图在UI线程上运行它:
Device.BeginInvokeOnMainThread(() =>
{
DisplayAlert("TEST", "TEST", "OK");
});
它不会改变任何东西。
我想你应该建立一个异步方法,并从构造 –
称之为@NathielPaulino但为什么它在我,因为现在创建的所有其他网页的工作? – greenhoorn
当我想创建一个'DisplayAlert'关闭我的当前课程,我从ContentPage继承,你有其他WrapLayout和工作?或只是在这个特定的页面? –