0
因此,我刚开始使用WPF。我正试图创建一个程序来加速制作卡片的过程。我目前正努力尝试将两个文本块的文本追加到一个richtextblock中(为了创建具有其效果和风格文本的卡的描述)。 WPF说第二个文本块是“未定义的”。 这是我的代码。WPF - 试图追加文本块文本抛出“对象引用未设置为对象的实例”错误
private void EffectInput_TextChanged(object sender, TextChangedEventArgs e)
{
Paragraph effectText = new Paragraph();
Paragraph flavorText = new Paragraph();
effectText.Inlines.Add(EffectInput.Text);
flavorText.Inlines.Add(FlavorInput.Text); //This is the line throwing the error
Description.Document.Blocks.Clear();
Description.Document.Blocks.Add(effectText);
Description.Document.Blocks.Add(flavorText);
}
我是新来的,该怎么办?
工作!谢谢! –