XAML Designer - default zoom?
Asked Answered
C

3

25

I feel very much annoyed by default zoom of XAML Designer in VS2015 (not sure if version is relevant), which is Fit all by default.

Is there a way to set it to 100% by default? Disabling zoom feature is also an option. But there is nothing related in VS Settings - XAML Designer.

P.S.: tagging it with languages to be visible to peoples like me, who only look at tagged questions (in my case C#).

Carew answered 3/12, 2015 at 14:43 Comment(2)
I can see an option of creating an addon and adjust zoom as needed.Velocipede
None of the answers help in my case. Visual Studio always opens xaml zoomed out to the maximum. Each window is just a dot when opened in the designer. I am currently using Visual Studio 2022, but if I remember correctly, this behavior has been present since 2015.Gray
V
8

Visual Studio 2015 (at least Professional with Update 1) remembers your XAML Designer's zoom setting.

Start just one instance of VS2015 and create a new WPF Application. Open the MainWindow.xaml and select the designer. In my case it opens up with 100% zoom:

Default 100 zoom

Now change the zoom to Fit all and then create a new WPF Application. Again open MainWindow.xaml and select the designer. The zoom should show something like 229.4% (which is the % for Fit all in this case):

Fit all default

Restart VS2015 and create new WPF project and again check the zoom. It should till default to your last selection.

Note: Selecting 400% didn't have this same behavior. The designer opened with 100% instead.

Vend answered 18/12, 2015 at 12:11 Comment(4)
Can't confirm that. Creating new wpf application, default zoom is 143.6% (probably depends on screen resolutions and VS layout), making it 100%, adding another wpf window to project or opening a new project - again 143.6%. Community Edition Update 1.Carew
Disregard my previous comment. You answer how to set it to Fit to all, but it's already Fit to all by default. I need 100% by default. Can you tell me how you managed to have it 100% by default?Carew
As I mentioned, my Visual Studio 2015 seems to remember the setting. The above example works from 100%->Fit all so now my default is Fit all. If I now do the same thing from Fit all->100%, it seems to work OK too. One key seems to be the "Create a new WPF Application". If I just add a new Window, there seems to be some issues.Vend
Once you have set the designer view for a xaml file it is persisted in the solution's .suo file. If you delete that file you're back at square one.Massasauga
B
3

With VS2015 the default option became "fit all", however, VS remembers your zoom settings for every XAML element. Once you set it to 100%, it stays there, even after closing project or solution. I couldn't find a way to change this default behavior.

The annoying thing is, when you have a large existing project created with VS2013 or below and start using 2015. Every XAML element previously showing at 100% is now fitted to the designer size.

After three month on VS2015, I'm still stumbling over "not-yet-touched" XAML elements popping up at 1360% zoom level.

Betthezel answered 14/1, 2016 at 13:29 Comment(1)
Who in their right mind changes a sane default of 100% to something totally random depending on the size of a page / window / control which always looks awful thanks to unsharp lines and weirdly resized text, even with a vector based UI like WPF? If they want to promote DPI awareness, annoying developers is not the right way.Puritan
M
3

If you're looking for a quick keyboard way of zooming to 100% do this ...

  • open a xaml file. I use a split window, it also works with just the design surface. The design surface needs to have focus for the next step to work
  • alt-G (opens the Design menu, only available if you are in the designer
  • alt-S selects "Actual Size" from that menu.

I added a keyboard shortcut shift-alt-0 (zero). In the options -> Environment -> Keyboard search for "Actual" and set a your keyboard shortcut in the "XAML Designer" ... or Global if you like and it's not killing another shortcut. The Designer needs to have focus for it to work so it can be fiddly at times.

But that whole "any default zoom you like as long as it is zoom to extents" is dumb

Massasauga answered 18/10, 2018 at 12:2 Comment(2)
An amazing workaround, thanks. I've set a hotkey ctr+shift+/ (it's 3 keys together on the left bottom side of keyboard) and then opening xaml, clicking inside designer and pressing it is much more comfortable than clicking pointing a little combobox and choosing "100%" item there.Carew
Left is the new right? (or is that just my keyboard?) That's a better keyboard combo, I'm switching to that before I get too much muscle memory... ah, wait, that's a Resharper shortcut I use all the time for block comments. Darn.Massasauga

© 2022 - 2024 — McMap. All rights reserved.