views:

227

answers:

3

I'm trying to add control to another tab item on design view, but I can only see the first tab item with all the controls I previously added and at the moment I can only add controls by hard coding on code view window, therefore I have to compile the program in order to see the results of the controls added by hard coding.

Any help would be appreciated.

A: 

If you're adding controls by hand, then you're hooped if you want to edit them in the designer.

I'm not sure about WPF, but in Winforms, if you create the control manually in the .designer.cs document, then they'll be added to the form's designer (but it's generally a terrible idea as visual studio will most likely mangle it when it re-generates/modifies that file).

SnOrfus
**This answer is WinForms-specific and is not applicable to WPF.** In WPF there is no .designer.cs and no hidden code that the designer modifies for you: Everything is there in the main XAML file, and you can edit it with the designer, a text editor, or both at the same time. So there is no danger of anything like this happening.
Ray Burns
A: 

Hi Audel,

As SnOrfus says, apparently it may create some conflict when you start doing some hard coding although it is uncommon thing what happen to you as I can work on the design view creating tab control, tab items and manipulating trough the design view.

My recommendation would be, 1.- Check if you have install the later Service Pack for Visual Studio. (Check for updates for VS2008) 2.- Start over your design from fresh, working only on design view. 3.- Try to use "Wrappanel" or "stackPanel" instead of canvas or grid inside of tabitem ( that will help you with the layout).

If you use WrapPanel you may need to look at the behaviour of scrolling and wrapping its content.

Hope this helps.

Cesar Lopez
The first paragraph is incorrect. Recommendation 2 (start over and work only in design view) is an unnecessary waste of time and will lead to bad habits in the long run. Audel **should** edit the XAML directly when it is appropriate to do so. The service pack idea is a good one and will probably fix this in this scenario, but see Jay's `IsSelected` suggestion as well.
Ray Burns
+3  A: 

I ran into an issue recently that sounds like this, basically the designer isn't recognizing that you've selected something other than the first tab. If you go to the properties dialog for that tabitem control and set the IsSelected property to True it should display that tabs content area.

However, I suspect that the real problem is that you don't have VS2008 SP1 installed since they fixed it with that update. Unfortunately Windows Update doesn't tell you that SP1 exists, not even VS2008's menu "Help>Check for Updates" tells you it's available. You'll have to go to;

http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en

to get it yourself. After it's installed the Tab Control works the way you'd expect it to work.

PS: Don't forget the 3 security updates to SP1, all 500MB of them. Windows Update finds them just fine.

Jay13