我正在创建一个像这样的超链接按钮:
HyperlinkButton hlbMail = new HyperlinkButton();
hlbMail.Height = 89;
hlbMail.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
hlbMail.VerticalAlignment = System.Windows.VerticalAlignment.Top;
hlbMail.Margin = new Thickness(60, -70, 0, 0);
hlbMail.Width = 290;
hlbMail.FontSize = 22;
TextBlock btnContent = new TextBlock();
btnContent.TextWrapping = TextWrapping.Wrap;
btnContent.Text = message;
btnContent.Visibility = System.Windows.Visibility.Visible;
hlbMail.Content = btnContent;
hlbMail.Visibility = System.Windows.Visibility.Visible;
mailStackPanel.Children.Add(hlbMail);
mailscrollViewer.Content = mailStackPanel;
PIMail.Content = mailscrollViewer;
但是我有一个问题,按钮的内容没有显示出来。可以看出,内容应该是 TextBlock 的文本(message var 是一个非空字符串)。内容未显示的原因可能是什么?