wpf Visual Studio 2015:默认情况下如何使用 XAML 代码,而不是拆分视图?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38766538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 13:53:39  来源:igfitidea点击:

Visual studio 2015: How to have by default the XAML code, not the split view?

wpfvisual-studioxamlvisual-studio-2015

提问by J4N

I don't use MUCH the XAML designer, but I appreciate at some time to have the possibility to use, and more, to have the "Properties" windows present to set some properties.

我不怎么使用 XAML 设计器,但有时我很欣赏有可能使用,并且更多地使用“属性”窗口来设置一些属性。

But I would like that when I click on a XAML file, I get the XAML code, without the GUI part. Basically, the Xaml Designer, but not in "split" view.

但是我希望当我单击 XAML 文件时,我会得到 XAML 代码,而没有 GUI 部分。基本上是 Xaml 设计器,但不在“拆分”视图中。

Is this possible?

这可能吗?

I found that it is possible to totally disable the XAML designer, but then:

我发现可以完全禁用 XAML 设计器,但是:

  • I don't get the possibility to just switch to this view(well with Open Width, yes)
  • More important, I don't have the "Properties" windows populated with the properties of the currently selected XAML
  • 我没有机会切换到这个视图(打开宽度很好,是的)
  • 更重要的是,我没有用当前选定的 XAML 的属性填充“属性”窗口

I also found that there is a setting with a default view(Tools, Options, XAML Designer, Default Document view: SourceView), but this doesn't work(or I didn't understood), I still get the default split view, even after a VS2015 restart.

我还发现有一个带有默认视图的设置(工具、选项、XAML 设计器、默认文档视图:SourceView),但这不起作用(或者我不明白),我仍然得到默认的拆分视图,即使在 VS2015 重启之后。

So is it possible to keep the XAML designer, but have by default only the XAML displayed?

那么是否可以保留 XAML 设计器,但默认情况下只显示 XAML?

回答by Rahul Sonone

Easy Way.

简单的方法。

Go to Tools -> Options.

转到工具 -> 选项。

and follow the screen shot. enter image description here

并按照屏幕截图进行操作。 在此处输入图片说明

回答by Mike Eason

To open .xamlfiles in XAML-only mode, you need to change the default editorthat .xamlfiles open with. Here's how:

要开.xaml在XAML-only模式下的文件,你需要更改默认编辑器.xaml文件的打开方式。就是这样:

  1. Right click on any .xamlfile.
  2. Click on Open with...
  3. Select Source Code (Text) Editor.
  4. Click Set as Default.
  5. Click OK.
  1. 右键单击任何.xaml文件。
  2. 单击打开方式...
  3. 选择源代码(文本)编辑器
  4. 单击设为默认值
  5. 单击“确定”

That's it. Opening any .xamlfile should now open in full XAML view. To get back to the designer, simply press Shift+ F7, or Right Click-> View Designer.

就是这样。打开任何.xaml文件现在应该在完整的 XAML 视图中打开。要返回设计器,只需按Shift+ F7,或右键单击->查看设计器

The only drawback that I have experienced is that Intellisense doesn't seem to pick up any resources(i.e DynamicResourceand StaticResourcereferences) that you may have.

我遇到的唯一缺点是 Intellisense 似乎没有选择您可能拥有的任何资源(即DynamicResourceStaticResource参考)。



If you still want the Designerrunning in the background, use the following instructions:

如果您仍希望Designer在后台运行,请使用以下说明:

  1. Go to Tools-> Options.
  2. Expand Text Editor-> XAML-> Miscellaneous.
  3. Check the Always open documents in full XAML viewcheckbox.
  1. 转到工具->选项
  2. 展开Text Editor-> XAML-> Miscellaneous
  3. 选中始终以完整 XAML 视图打开文档复选框。

This will open all .xamldocuments in full XAML view, to switch back to the designer, simply click on the Designtab.

这将.xaml在完整的 XAML 视图中打开所有文档,要切换回设计器,只需单击Design选项卡。

回答by Timut mut

New place XAML Designer options. screenshot

新位置 XAML 设计器选项。 截屏