Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I have used C# WPF to write a program.
This program allows the user to make some tabs.
Each tab has some items inside.
The user can add/remove any tab or item.
Each time the user closes the program, the current tabs and items will be saved inside a file.
Tabs and items are binded with TabpageItem and InfoItem classes.

When the program starts, the user sees the tabs. At first no tab is selected. If user selects any tab, the tab is shown correctly according to the data binding.
Image 1 (Desired)[^]

The problem is when the user selects another tab. At this time, items are not shown correctly(the user control inside the tab is blank)
Image 2 (Undesired)[^]

I have uploaded the program:
http://www.megaupload.com/?d=FL6BB1YK[^]

Please have a look at it. If you have a suggestion, please test it on the program in advance.
Any helpful idea is appreciated.
best regards.
Posted
Updated 11-Aug-11 10:52am
v4

1 solution

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:

  1. Try to bind the properties of all controls in that UserControl to a class
  2. Then create a new object of that class for each new tabs that you create so that each tab can retain its content.

Note:

  1. I would have been able to help further but your solution contain some NullReferenceException also in the UserControl.
  2. 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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900