0 c# windows-runtime windows-phone-8.1
我试图通过"HardCode"使用ContentDialog不在XAML页面中,我有很多TextBlocks要使用,所以我可能需要在ContentDialog中使用ScrollView或ListView,这是我的代码!
TextBlock txt = new TextBlock();
txt.Text = "TI Cajueiro Seco / Rua do Sol";
txt.FontSize = 25;
txt.Foreground = new SolidColorBrush(Colors.White);
txt.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
txt.VerticalAlignment = VerticalAlignment.Top;
txt.FontFamily = new FontFamily("/Fonts/MYRIADPRO-BOLD.OTF#Myriad Pro");
TextBlock txt2 = new TextBlock();
txt2.Text = "Rotas da Linha";
txt2.FontSize = 25;
txt2.Foreground = new SolidColorBrush(Colors.White);
txt2.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
txt2.VerticalAlignment = VerticalAlignment.Bottom;
txt2.FontFamily = new FontFamily("/Fonts/Exo-Regular.ttf#Exo");
Grid grid = new Grid();
grid.Children.Add(txt2);
grid.Background = new SolidColorBrush(Colors.Red);
StackPanel stk = new StackPanel();
//stk.Children.Add(bar);
stk.Children.Add(txt);
stk.Children.Add(espaco);
stk.Children.Add(grid);
//stk.Children.Add(txt3);
stk.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
Grid contentGrid = new Grid();
contentGrid.Height = Window.Current.Bounds.Height;
contentGrid.Width = Window.Current.Bounds.Width;
contentGrid.Width -= 40;
contentGrid.Children.Add(stk);
ContentDialog dlg = new ContentDialog();
dlg.Content = contentGrid;
SolidColorBrush color = new SolidColorBrush(Colors.Black);
color.Opacity = 0.9;
dlg.Background = color;
dlg.ShowAsync();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1897 次 |
| 最近记录: |