Visual Studio - How to open a second window with a designer? - wpf

I need quite simple help with Visual Studio in which I build my application based on WPF.
By accident, I closed the top window in which the designer was.
Currently, in both windows there is a code, and not as before in a single visual project.I spent over 30 minutes searching for a solution on Google, but I can not find anything. As it is now:
What is expected:
Thanks!

Based on some clarification in the comments of what you were looking for, once you're in the design view and you've closed the Design/XAML Split, you can reset the window by clicking one of the split/open icons in the bottom right hand corner of the window.
With the method you put into your answer, I believe that won't give you the other Designer options (like snapping controls to a grid, disabling/enabling rendering effects/etc) on the window.

Just found a solution:
1. Select the tab you want two copies of
2. Select menu Window → New Window from the menu.
3. Right click the new tab and select New Vertical Tab Group
Open two instances of a file in a single Visual Studio session

Related

Simple ControlTemplate (edit a copy) for WPF Window doesn't work in Blend for Visual Studio 2017

Goal: Edit the ControlTemplate of a Window to remove the caption buttons via Blend (Close/Minimize/Maximize). Why? Need a window with a title bar (draggable) that can't be closed/minimized/resized. It's a temporary status window that pops up, etc. (I've seen solutions that go into the Win32 APIs, and wonder why. This should be doable via Blend!)
Anyway... Blend for Visual Studio 2017 seems to be OK with my attempt. At least initially.
Click "[Window]" in the Document outline and then select "Edit Template => Edit a copy"
Blend complies and gives me this control template.
However, immediately the XAML is flagged as having errors.
I figured "well, maybe this is just a designer issue. Maybe it will build." Nope.
"The type reference cannot find a public type named 'WindowInstance'.
"The name 'WindowInstance' does not exist in the namespace
'clr-namespace:Microsoft.VisualStudio.DesignTools.WpfDesigner.InstanceBuilders;assembly=Microsoft.VisualStudio.DesignTools.WpfDesigner"
Well, I've looked for "Microsoft.VisualStudio.DesignTools.WpfDesigner" on both NuGet and in the install folders and it doesn't seem to be there.
I've also read this solution, which mentions adding "Blend for Visual Studio SDK for .NET" in the Visual Studio 2017 installer under the "Individual Components" page. I've done that. Still I have the error.
I'm uncertain where Blend got the initial ControlTemplate from in the first place if it doesn't resolve to an assembly on my machine.
Regarding the actual solution... what I'm doing now is faking a window with a title bar (that has no buttons) and using the system brushes to make it look like a window with a title bar--but that isn't draggable... which is another problem to solve.
Really, why I can't do something as trivial as removing control buttons from a window is beyond me. I suppose there are philosophical reasons to not allow people to remove the close button on a window, but that shouldn't be some arbitrary call that a dev at Microsoft gets to make for me or anyone on my team.
Thank you for your assistance.
Chad.

How to undo a "Reset Toolbox" in VS2008?

Is there any way to "un-Reset" the Toolbox in Visual Studio 2008?
I was trying to get my first-ever WPF UserControl to appear in the Toolbox. I rebuilt my project, then right-clicked on the Toolbox and chose "Reset Toolbox" from the pop-up menu; hoping that would "refresh" the control list (I know better now). Alas, the reset removed ALL the controls from the Toolbox for WPF projects (It's still OK for Win-Forms projects).
So is there a relatively quick way to restore all "the standard WPF controls" to the Toolbox?... I only had the standard controls (being a WPF noob) so "No" I didn't take a backup before I hit the reset switch... BIG Sigh!
Thanking you all in advance,
Keith.
EDIT: To document my (sort of) resolution to the problem...
I got my WPF controls back, but they're not in there nice seperate toolboxes (i.e. the expandable sections, or whatever you call them). Meh! It'll have to do ;-)
To get them back... With a WPF Window open (Window1.xaml for example): right-click on the General "toolbox", select "Choose items ..." from the pop-up menu, goto the "WPF Components" tab, select ALL items and click the checkbox of the last item (to make all tools visible), then click the OK button... then (if you want) right-click on the toolbox and select "Sort Items Alphabetically" then go back into right-click-Toolbox ~ Choose Items ~ WPF Components; and untick all those items which don't have distinctive icon (the "default icon" is a white window with a blue border containing a "cone" which appears to be blowing red bubbles... stoners beware?!?!). You'll probably have to OK your "unticks" half-way down the list, coz you can't scroll the toolbox (too see the icons) whilst the Choose Items dialogue is open.
Cheers all. Hope this helps the next MS Victim.
Keith.
PS: For what it's worth, I still think this is a "bug" in VS2008... Resetting the toolbars should retore them to there original condition. Which, as far as I'm concerned, includes the "out of the box" WPF toolbox configuration. I presume it's lost them coz the WPF Toolbox's where/are a "tack on"... implemented as "custom" toolboxs (the same as a user-defined toolbox). Sigh.
If it's still a "bug" in VS2010 then maybe it should be reported, so that atleast it (probably) won't be propagated to 2012, or whatever comes next.
Did you try running this command in VS2008 Command Prompt-
del "%LocalAppData%\Microsoft\VisualStudio\9.0\*.tbd"
Refer to this link - http://msmvps.com/blogs/coad/archive/2010/05/07/reset-the-visual-studio-toolbox.aspx
As per this it will re-populate the data.
It's probably a bit late now, but I find if I change environment settings etc and want to get them back I open a 2nd copy of Visual Studio before I close the other Visual Studio instance. Then close the one you changed and then immediately close the 2nd version.
This normally persists your settings from the last instance closed for next time opening.

Why is my WPF Events Tab gone?

I cannot see it any more in Visual Studio 2010. How can I do to get it back?
I have no addins as I just installed VS Studio.
Nevertheless this occurs on an existing solution with many projects inside. When I create a new WPF project from scratch the tab reappears.
It sounds like a piece of UI is missing from your Visual Studio display. Try the following to get it to show back up in it's original location
Tools -> Import / Export Settings
Select "Reset all settings" and hit Next
Save your current settings if you desire and hit Next
Pick the profile of your choice and hit "Finish"
Possible ways to fix:
Try remove all add-ins and
extensions.
Tools -> Import And Export Setting
-> Reset all settings
Repair Visual Studio installation.
It's not possible to give exact solution with such description of problem.
Your User Options file is broken.
To fix it, do the following:
Close Visual Studio
Go to the folder in which your .sln file reside
Delete the User Options file
Open the solution again
The Events tab is back!
Are you talking about the Properties Window? If the Properties Window is displayed, click on the yellow lightning bolt button towards the top. That will show you the events for the currently selected WPF element. If the Properties Window isn't open, press F4.
This is not a bug, but rather where the focus is set in your visual studio instance design view. From the design view click the window and then do properties (F4). This will enable the events to show and be set from the properties tag. Just make sure the focus is set on the proper item from which you want to set the events (dropdownlist, window, ect.). Hope this helps.
I clicked on the "Design" tab in the bottom and the "Lightning bolt" (Event tabs) reappeared, then it was still available after going into "Source" view mode.
Hope this helps someone.

Visual Studio design time event handling

I am trying to create a WPF wizard control in visual studio. I am successful except I would like to navigate the pages in design time by clicking the next and previous buttons. The pages are being written in xaml. I can navigate the pages by going to the properties window and changing the selected index, but I would like something more user-friendly. I remember doing something similar in a winforms project having something to do with overriding maybe wndproc and listening to mouse click events from the designer.
So I've been googling and I can't seem to google the right words to bring this up.
Can anyone please help!
You need to create a custom Adorner as described here. There are two walkthroughs there that should help.
Ultimately, you would need to overlay a transparent button on top of your actual buttons. Then in the click handlers you'd update your selected item/index.

Blend 3 - Keyboard Shortcut to switch between design and xaml views?

As I'm not more of a developer than a designer I like to hand code my xaml rather than using draggy-droppy stuff.
Since silverlight 3 - the design preview in VS2008 has disappeared. It wasn't that great but at least I got a visual representation of my markup without having to run the application.
So I installed Blend 3 and I'd still like to hand code my xaml.
Does anyone know a keyboard shortcut to switch between design view and xaml view - I've tried editing the xaml in VS then tabbing over to blend but theres a small delay that can be annoying when I just want a quick preview.
Thanks.
For doing the thing you want please test the following solution:
Navigate to Tools menu of the visual studio
Click the Options menu item
From left pane choose the Environment and then Keyboard
From right pane choose the Visual C# 2005 combobox item
Now you can easily switch between xaml and the desing view by pressing Shift + F7
Are you talking about while in Blend? In which case it's F11 to toggle view.
If your talking about toggling between VS and Blend then I don't think it can be done, but you could try adding a Keyboard Shortcut in Tools->Options->Keyboard (not tried it and don't know if it would be successful).
In Blend you can use F11 to toggle between the three states:
Design View
Xaml View
Split View
It seems to me that what would help you the most is to change your default view:
-> Tools
-> Options
-> Documents
-> Change the Default Document View to either Xaml or Split View
And there is a way to toggle between VS and Blend: I do this all the time with Alt + Tab. I'd be cautious though: you should save the solution before switching to keep the two apps in synch.

Resources