Reputation: 527
I have the codes above which create a popup with a textblock, a progress bar and a button programmatically then show. Progress bar and button were ok but the textblock I added to stackpanel.children didnt show up. Anyone have idea for this problem ? Thanks so much.
var tbInfo = new TextBlock {Text = "Checking... ", TextWrapping = TextWrapping.Wrap, Visibility = Visibility.Visible};
var mainPanel = new StackPanel {Background = new SolidColorBrush(Colors.Black)};
var popupBtnCancle = new Button {Content = "Cancel", Margin = new Thickness(3)};
popupBtnCancle.Click += new RoutedEventHandler(popupBtnCancle_Click);
var pbLoading = new ProgressBar
{
IsIndeterminate = true,
IsEnabled = true,
Visibility = Visibility.Visible,
};
mainPanel.Children.Add(tbInfo);
mainPanel.Children.Add(pbLoading);
mainPanel.Children.Add(popupBtnCancle);
border.Child = mainPanel;
_loading.Child = border;
_loading.VerticalOffset = 0;
_loading.HorizontalOffset = 0;
_loading.IsOpen = true;
Upvotes: 0
Views: 636
Reputation: 540
Somehow the default background for Popup
s is black. Your text is rendered in black letters, though.
Black cats at night are hard to spot :)
Set one of the two values to something else and you'll see that your TextBlock
is indeed there.
Upvotes: 1