I don't know why people have not responded to your questions yet, maybe they encountered the same challenges I had with your project. Your code is jam-packed and it's not easy to step through but from what I noticed, I think the problem comes from the User Control that you set as the Datatemplate for the TabControl and also with the way new tabs were created. I said this because if you delete the last tab, the content on the previous tab shows back, if you tried that to the last tab, the issue is the same. Try to revisit the UserControl again.
Suggestions:
- Try to bind the properties of all controls in that UserControl to a class
- Then create a new object of that class for each new tabs that you create so that each tab can retain its content.
Note:
- I would have been able to help further but your solution contain some
NullReferenceException
also in the UserControl. - I should also point out that I checked your activities on CodeProject and I see that you dont favour people with vote even when they tried to help. You may not be able to get must help here (I mean on CP) if you continue this way. If you think the solution I've provided is not clear enough, just ask...there's no need to downvote.