The solution explorer and windows forms

I have a design question for you. Yes, I don’t own the project system anymore, but
I started this particular issue, and I want to follow up on it:

In VS 2002, whenever you double-click on a form file in solution explorer, the project
system always opens the form designer on that file.

We are considering modifying the behavior in Whidbey so that the project system will
track the most-recently-viewed state for the file. If you had most recently looked
at the code view, double-clicking would take you to the code view. If you had most
recently looked at the design view, double-clicking would take you to the design view.
This state would not be persisted across closing and reopening the project.

What do you think? Should we stick with the current behavior, or should we change
to the new behavior? And why?

Comments (53)

  1. Jacob (MVP) says:

    Well, the default is to open in design view, but you can change it such that the default opens in Code View. I would prefer that you *not* track state for the sole reason that I can currently guarantee what will happen when I double click. If you track state, I will resort to right-click -> open because I may not recall how I opened the file previously.

  2. ::so that the project system will track the most-recently-viewed state for the file.

    I dont like this. I come back after a month on a file, and the behavior I get is random – I do not remember what I opened the file in the last time. like a better UI to select, but – sorry – this "perceived randomness" is against my feelings. Maybe it works great, maybe not – did you gus do any testing on this?

    I prefer to have repetitive behavior. Make it, definitly, a choice – I would actually live better if I could select the default view. But not this per file "randomness".

  3. orangy says:

    agreed with other people on randomness, it looks awful. I’d prefer option so I can set preferred behaviour. What could be good addition is reversed behavior with, say, ALT pressed. So double-click opens Code (as set in options) and ALT-DoubleClick opens Designer.

  4. Bryan Stafford says:

    Just give me a choice of the default view and don’t track. I want to be able to count on a particular behavior (i.e. code view coming up when I double click) and always have it come up that way. I would bet that most developers spend 90% of their time in code view for any given module so this would cover most cases anyway.

  5. Mark says:

    I think that would be a great addition.
    One feature that disappeared between 2002 and 2003 that really drives me nuts, was that when you changed between document tabs the project tree view would update to select the current page you are viewing. Then by clicking the view code button (or menu option) it would open the code behind page for the aspx file you are looking at. In 2003 it doesnt update the selection, so you have to go find the correct file first if it isn’t already selected.

  6. Dunc says:

    ASP.NET or WinForms? Nah – just educate people about F7 and shift F7

  7. Ryan Rinaldi says:

    I have to agree with the other fellows that any sort of randomness would result in confusion or at the minimum it would cause frustrations. I do like the idea of a ALT + DoubleClick opens in a code view versus a normal DoubleClick in design view. That would probably be the best option.

  8. Neil Cowburn (MVP) says:

    I agree with Dunc — educate people about F7 and Shift-F7. I use that all the time, but then again I prefer keyboard shortcuts to mouse clicks.

  9. Jacob (MVP) says:

    For those people asking to be able to set the default, you can already do this:

    In VB: Right Click the file -> Select Open With -> Choose "Microsoft Visual Basic Editor" and Click "Set as Default"

    In C#, it should be something similar . . .

  10. I’m with most everyone else, just give us as many options as possible. I like tracking the previous state, but let me override it via some configuration settings in the Options window, AND let me do it "on-the-fly" using short-cut keys, ala doubleclick/ALT+doubleclick. I want it all, dangit! 🙂 Is that so wrong? Heh.

  11. Ryan Farley says:

    I’d prefer to have it open the same way all the time. If I am unsure which way it will open, then I’ll resort to always opening in other ways. If anything, make it easier to set an option to have it open code or design by default.

  12. Dave Angers says:

    I would like to be able to set the default action by file type whenever there is a choice in views, ie for forms, aspx, xml schema (xsd) and any others. That way I can decide based on the way I work and perhaps based on the current liftime of the project. Also, I am greatly annoyed when (with aspx I believe) the design view fails to open (because of some problem I introduced or something I that hasn’t built yet). Give me something, like code view, so I can fix the problem.

  13. Eric,

    Personally, I like the idea. I can’t stand always going to the form view, as I usually am writing code. I think that the VB people would want it the other way though, as it fits more with the idea of RAD, which is what VB promotes.

    As always, give me the option to shut it off, or to always go to a particular state and that would be great. Also, being able to modify this based on the type of the designer would be great.

    – Nick

  14. Corrado Cavalli says:

    I think that the "Let developer decide" is the best way to handle this issue, frankly speaking I don’t have a better option for this because of different situations , sometime s it is better to track other not, having this option selectable will solve all users indecisions.

  15. Ajay Mungara says:

    I personally think the best thing to do is to leave the option to choose between the new way and the old way as part of the project options. I am not able to make up my mind around the usefulness of this functionality as at times i think it may be good and at other time it may be confusing so the reason for the configurable option.

  16. Jean-Claude Manoli says:

    I think the proposed new behavior is very bad, as you’ll never know which file will open in design view or not.

    Most of the time, I use the code editor, so I want to add my vote for adding an option to let the user decide what the default behavior is.

  17. Greg_Ewing_MVP says:

    I like the remembered state behaviour. A couple of questions:
    – If I was in design view, double clicked a button which opened the code view and then double clicked the file in solution explorer, what view would open? Code view would stay open, right?
    – Is this a feature which could be turned on or off?

    I guess overall I’m sort of ambivalent. It seems to me that 1/2 the time I want the page to open in one view, 1/2 the other. It probably mostly depends on where I am in a project, beginning of a project tends to have more form/aspx layout issues for instance. Not sure that is really true but it’s a gut feeling.

    One thing that could be really nice is to be able to specify the open state for different file types. For instance, web service files shouldn’t open in the designer. Web forms and Win Forms though it makes sense to have the save last state.

  18. Kristofer Goss says:

    Definitely let the developer decide vs. removing entirely. Since we’re in pseudo feature request mode, it would be really nice to also provide a designer layout vs. a code layout window settings… eg. dock property grid and toolbox in one view, vs. pure code view in the other. Some addons have done this from GotDotNet, however; they were pretty buggy.

  19. Phil Haack says:

    Personally I like the option, but even better, I would like it if the first time you double click a web forms page, it gives you a pop-up with four options (always open in design, always in html, always in code-behind, always the last option) and a check-box to allow you to persist that setting so the next time you won’t get the pop-up. That way as people work their way through VS.NET, they are learning about how it can be configured and setting custom options as they need it.

  20. John Cavnar-Johnson says:

    I like the remembered state option. If you have to default, I would prefer to default to the code view.

  21. Monte Hansen says:

    I hate too many unimportant project options. There are too many important ones that can be obscured by unimportant ones. I think ther are more passive ways to express this option. For instance, if a "best global default" cannot be reached, why not add it as a right clickable option on the form itself, like "Set as default view" and "Set as default view for all", etc. Put the option into it’s context rather than clutter the options dlg.

    I think there needs to be a gatekeeper for project-level options and if it were me, this one wouldn’t make it. Take Word, for example, hell if I can find an option if I wanted to since there are just so many — it’s a needle in a hay stack. But maybe that’s just me..

  22. Yes…please make this change or allow me to specify how to open either specific files or all files of a certain type. We see this in the XML editor that we can specify how to open an XML file (designer or XML by default), but that doesn’t work for all project items.

  23. Nic Wise says:

    I’ll vote for "the one I set in the options". And always, under every circumstance, the one I set in the options.

    Web forms are especially odd with this – I’d love you have an option saying "dont ever go into the HTML-messing, code-screwing designer view – just show me the HTML"

    (actually, there is one, but it seams that 2002 and 2003 ignore it now and again….)

  24. Monte Hansen says:

    After all that, I neglected to state my preference: go to the code. always. =>

  25. Dave Burke says:

    I’m a code always guy and do not want randomness nor feel that tracking is necessary. Thanks for asking!

  26. Paul Jackson says:

    I agree with majority of your readership and think that VS should *not* remember what you did last, as it’s unlikely that I will. As long as you can configure what you want to happen then it becomes the programmers choice, that way everyone is happy.

  27. Sam Meldrum says:

    I have changed the default to always open in code view because I so rarely open in design view. On the odd occassion I want the design view it is easy enough to hit Shift+F7 or to open from the design button. If you tracked state I’d start to get irritated as I may have gone back to Solution explorer to switch views – if I have lots of files open – so opening in the last state would not be what I wanted.

    On a related note, I initially found the CTRL+TAB behaviour very irritating – I like to know what order the tabbing is going to take me through the files. I got used to it eventually, and I accept that I now have fewer CTRL+TABs to press in general, but I have to CONCENTRATE so much harder on what file is coming up when I flick through the files to find the one I want.

  28. Jeroen says:

    Why change a working bahaviour. Functionallity is trivial, there anyhow. Never heared anyone complaining in my teams, and, if this feature is gonna save your projects productivity, hell, you’re in trouble…

  29. Aaron Fanetti says:

    I rarely use design view so the faster I can get to code view the better. Sure F7 works, but it would be great to have a simple click-based mechanism – especially since I’m using the mouse anyway to select / specify the file. I agree however that the "randomness" factor could be troublesome. It would be better to have an "Open files in Code View" config option available.

  30. Sam Meldrum says:

    Aaron, the option is there, from the solution explorer Right click on a form, choose *Open With*, then choose *Set as Default* on your desired view. This will then be the default double click behaviour.

    And on state persistence: "NO!" what I want from a development environment is predictability, not something trying to second guess my intentions!

  31. Martin Crimes says:

    I agree with the majority here – stick with what we have in picking a default.

    I was completely unaware of the "Open With.." setting though.. I think it would make more sense to have had this setting in the Options, in the same way that you can pick for ASP.NET pages whether to open HTML or Design view.

    Another day, another hidden feature of DevStudio found.. 🙂 Thanks.

  32. Jeff Stong says:

    I like the idea (and not keeping the state across project open/closes removes some of the "randomness" other comment have alluded to). Personally I find the current behavior annoying.

  33. Vic Berggren says:

    I would like for VS to offer me the ability to set the option of allowing it to remember my "last known view" if I choose to set it either on a project level or VS as a whole.

  34. Mark Hurley says:

    I would vote to have VS remember my "last known view" as well. Rock on guys!

  35. Chris Jackson says:

    You already have most of the options you need. (I’m thinking of ASP.NET here, because that’s the world I’ve been living in for several months now.) By showing all files, I can go directly to the code behind, or I can go to the HTML/Designer. I have the option to default either to the designer or to the html view – if you want to add a third option (NOT on by default) then it won’t hurt anyone. I know I won’t use it, however. If you are going to add one thing, I would add the ability to open up an asmx file WITHOUT the designer. I have never once used that designer, but even if I go directly to the .cs file, I still get the designer, and I’m still one click away from actually getting something done. I hate that. I know you don’t own this any more, but you opened the door for me to vent. 🙂

  36. Larry Wright says:

    I agree with everyone who said it should be an option as to which view opens when you doubleclick, I think having it track what you did last would be confusing.

  37. Addy Santo says:

    While I agree with the majority that tracking might get confusing, I think that it would work great for the current "session"… meaning that when I fire up VS and load a solution, use the defaults. But while I am working, if I close and reopen a file, show me the view I was last working on.

  38. Mark Levison says:

    Please give us an easy way to make the default code only (or whatever the user). None of our forms/components can be opened in the designer. So the default double click behaviour is maddening.

  39. dr says:

    What would be cool is to have the setting first of all, be optional, but secondly expire at the end of some time period selected by the user. For example, someone might feel comfortable if the last view state were tracked for 24 hours, some for seven days.

  40. Greg Sohl says:

    The 2002 default of showing the WinForm has been a bit of a grip around here. We would prefer to have an option, one of which could include "tracking most recently used".

  41. Just make it a defaut you can set in Tools|Options. Saves me the extra F7 and it doesn’t need to clutter the .suo files.

  42. Don Browning says:

    +1 on setting it in Tools | Options

  43. jgalla says:

    Sounds like a great idea.

  44. Hassan says:

    I’d like the new functionality described. Even if it wasn’t configurable as others recommend.

  45. Bruce says:

    Make it as an option is better.

  46. Pavel Sich says:

    Definitely change that. I would even say change it to code view by default. Why? Form is designed and much less frequently changed in UI than in code during debugging and so on. Hope this helps.

  47. Without a doubt this should be an option. Whenever I come across a question in which there are two perfectly valid responses, I always ‘choose’ to let the user decide and add a configuration option.

    What I would *love* to see in the VS.NET IDE is the ability for the IDE to remember the expanded/collapsed state of the regions in the file. I use a folding editor way back in 1987-88 (when writing Occam on a Transputer), and this had the ability to track the open/closed state of the regions (‘folds in those days!).

    If you’re looking for somewhere to store this information, why not use a separate stream on the source file and store the information there. That way it lives with the file but everything (except VS.NET) is oblivious to the fact that there is extra information within the file.

  48. DrFooMod2 says:

    Thanks to Jacob, I changed the default to open into code view. I’m happy with that, and therefore, whatever you decide to do, knock yourself out.

  49. Chris Sells says:

    I’m not a big fan of s/w that attempts to be "smart" in this way, because it’s wrong just about as often as "dumb" s/w is wrong. The difference is that dumb s/w is always wrong in the same way and I can adjust my fingers and reactions to anticipate the wrongness, because I always know what it’ll be. With smart s/w, it’ll be wrong unpreditably and I’ll have to slow down to detect the wrongness so that I can deal with it.

  50. Anonymous says:

    In the Solution Explorer, I would rather have two entries: one for going into the design view and one for going into code view. Most of the time I think I know what I want to do and could click on the correct item.

    You currently have something close to that with the ‘Show All Files’ selected at the top of the Solution Explorer. It though allows you to open either the code view or the .resx files. The data view of the resx (xml) file viewer is one place where some persisted state would be a welcome improvement. In the Data view, I resize the columns in the data grid. Switch to XML view and then back to the data view and the columns are back to the default widths.

  51. I don’t like this for many of the above reasons. What I would like to see is another option that can be set as default. Open both design and code. Have the option to specify (same tab group, new vertical tab group, new horizontal).

    To be honest I don’t like the level of decoupling between the two viewes, to me they are the same file and a better design would be more like the design/code doc tabs. it’s a single document that should only have a single tab in the EzMdi.

    While we’re at it, i would like to mention one of my biggest griefs with XmlDocs the are very helpful for internal apps, but when you’re creating commercial components we need to use those generated xml files to include with the assembly like ms does. The docs need to be edited by UE people who do not have access to the source. and the comments are not persisted in a separate file for easy editing. I wonder how MS deals with this when documenting the framework.

  52. RichardH says:

    It makes sense since after inittial UI design, we are getting at the code only most of the time, in fact, I wouldn’t mind having the code view as the default. Currently, I do UI prototyping in VB6 (its fast and nostalgic 😉 ) and only go into C# when I can see the flow of user interaction, so UI designing is done first and then we are continuously getting at the code the rest of the time. So I would say ‘Yes’.