【发布时间】:2014-08-13 20:49:50
【问题描述】:
当用户尝试登录我的应用程序时,我正在显示一个 ContentDialog,其中包含一些 TextBlock 和一个 ProgressBar。
我选择 ContentDialog 是因为它是模态的,会在应用程序收集所需信息并准备好导航到下一页之前阻止用户。
以下link 显示了可用于 Windows Phone 8.1(通用应用程序)的内容对话框类。
以下代码显示了我编写的用于显示 ContentDialog 的代码隐藏(我暂时将其放在 OnNavigatedTo 中进行测试,稍后将其移至适当的通知函数)
//Progress Bar
ProgressBar bar = new ProgressBar();
bar.IsIndeterminate = true;
//Downloading Data text
TextBlock txt = new TextBlock();
txt.Text = "Downloading data...";
txt.FontSize = 17;
txt.Foreground = new SolidColorBrush(Colors.White);
txt.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
//This could take a few seconds
TextBlock txt2 = new TextBlock();
txt2.Text = "This could take a few seconds.";
txt2.FontSize = 17;
txt2.Foreground = new SolidColorBrush(Colors.White);
txt2.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
//Please do not close the application.
TextBlock txt3 = new TextBlock();
txt3.Text = "Please do not close the application.";
txt3.FontSize = 17;
txt3.Foreground = new SolidColorBrush(Colors.White);
txt3.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
StackPanel stk = new StackPanel();
stk.Children.Add(bar);
stk.Children.Add(txt);
stk.Children.Add(txt2);
stk.Children.Add(txt3);
ContentDialog dlg = new ContentDialog();
dlg.Content = stk;
SolidColorBrush color = new SolidColorBrush(Colors.Black);
color.Opacity = 0.7;
dlg.Background = color;
dlg.Margin = new Thickness(0, 250, 0, 0);
dlg.ShowAsync();
这显示为 上面你可以看到它只覆盖了部分背景
我希望它显示为
通过制作全屏模式。
我已尝试更改高度和其他属性,但无法正常工作。
如果有人能指出我正确的方向,我会很高兴。
【问题讨论】:
标签: c# windows-phone-8.1 win-universal-app