Search code examples
c#wpftextboxrichtextbox

Cant clear textbox and richtextbox


I have a WPF project with a navigation window and a few pages. On one page I have a textbox and two richtextboxes. With a click on a button I want to clear the textbox and the two richtextboxes with the following code:

private void resetGUI()
{
    txtIndex.Clear();
    richEinzelTxtBemerkung.Document.Blocks.Clear();
    richTxtBemerkung.Document.Blocks.Clear();
    checkHauptzeichnung.IsChecked = false;
}

But it doesnt work. It seems that the clear method delete the value of the fields internal but in the GUI the value stays.

So what do you think might cause this problem?


Solution

  • Okey i found my mistake. I fill the Boxes again after clearing them. J found a mistake with a index count.