Hello,
I can reproduce it, if you set FormattedString
for your Label, when you get the value from the Label, you cannot get the text by OutputTextRichTextBox.Text;
and it will return null value.
Then I create a new FormattedString OutputBackupformatted = new FormattedString();
When you use it in HGL_CheckedChanged
, you can get FormattedText
by OutputBackupformatted =OutputTextRichTextBox.FormattedText
and set it by OutputTextRichTextBox.FormattedText = OutputBackupformatted;
.
private void HGL_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
if (HGL.IsChecked == true)
{
OutputBackupformatted = OutputTextRichTextBox.FormattedText;
OutputTextRichTextBox.FormattedText = HelpStrformatted;
OutputTextRichTextBox.FontSize = fontSize;
brdrInput.IsVisible = false;
mainGrid.RowDefinitions[4].Height = new GridLength(0.5, GridUnitType.Star);
mainGrid.RowDefinitions[6].Height = new GridLength(0, GridUnitType.Star);
mainGrid.RowDefinitions[7].Height = new GridLength(0);
}
else
{
OutputTextRichTextBox.FormattedText = OutputBackupformatted;
brdrinput.isvisible = true;
maingrid.rowdefinitions[4].height = new gridlength(1, gridunittype.star);
maingrid.rowdefinitions[6].height = new gridlength(1, gridunittype.star);
maingrid.rowdefinitions[7].height = new gridlength(2);
}
OutputTextRichTextBox.FontSize = fontSize;
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.