private void CreatePopup(string msg, bool isError) { _popup = new Popup { VerticalAlignment = VerticalAlignment.Top, RenderTransform = new TranslateTransform() }; #region grid var grid = new Grid { Background = new SolidColorBrush(_color), Width = Window.Current.Bounds.Width, VerticalAlignment = VerticalAlignment.Top, ManipulationMode = ManipulationModes.TranslateY }; grid.ManipulationStarted += grid_ManipulationStarted; grid.ManipulationDelta += grid_ManipulationDelta; grid.ManipulationCompleted += grid_ManipulationCompleted; grid.Tapped += GridOnTapped; #endregion #region stackpanel var panel = new Grid { Margin = new Thickness(30, PaddingPopup, 20, 20), VerticalAlignment = VerticalAlignment.Bottom }; panel.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto}); panel.ColumnDefinitions.Add(new ColumnDefinition()); #endregion #region text blocks var title = new TextBlock { Text = isError ? "" : "", FontWeight = FontWeights.Bold, FontSize = 22, Foreground = new SolidColorBrush(Colors.White), FontFamily = new FontFamily("Segoe UI Symbol") }; var subMsg = new TextBlock { Text = msg, FontSize = 16, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(20, 0, 0, 0), Foreground = new SolidColorBrush(Colors.White), TextWrapping = TextWrapping.Wrap }; Grid.SetColumn(subMsg, 1); #endregion panel.Children.Add(title); panel.Children.Add(subMsg); grid.Children.Add(panel); _popup.Child = grid; _popup.IsOpen = true; //Make the framework (re)calculate the size of the element grid.Measure(new Size(double.MaxValue, double.MaxValue)); }
private void CreatePopup() { _popup = new Popup { RenderTransform = new TranslateTransform(), Opacity = 0 }; var grid = new Grid { Background = new SolidColorBrush(Colors.Gray), Width = Window.Current.Bounds.Width, Height = Window.Current.Bounds.Height }; var panel = new StackPanel { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; #region Message Text Block _subMsg = new TextBlock { Text = "Loading...", FontSize = 16, HorizontalAlignment = HorizontalAlignment.Center, Foreground = new SolidColorBrush(Colors.White), TextWrapping = TextWrapping.Wrap }; #endregion #region Progress bar var progress = new ProgressBar {IsIndeterminate = true}; #endregion panel.Children.Add(_subMsg); panel.Children.Add(progress); grid.Children.Add(panel); _popup.Child = grid; _popup.IsOpen = true; //Make the framework (re)calculate the size of the element grid.Measure(new Size(double.MaxValue, double.MaxValue)); }