[英]How to fix a xaml.cs indentation problem in WPF (Visual Studio 2019)?
I am currently developing an application in WPF (.NET Core) and I'm encountering an indentation problem.我目前正在WPF (.NET Core)中开发应用程序,我遇到了缩进问题。
Here is the App.xaml.cs when I manually format it:这是我手动格式化后的App.xaml.cs :
When I go back to the line, my cursor goes here:当我 go 回到线路时,我的 cursor 在这里:
If I format the document ( Ctrl+K, Ctrl+D ):如果我格式化文档( Ctrl+K, Ctrl+D ):
I don't have this problem in UWP , and I don't know what to do to solve this problem.我在UWP没有这个问题,我不知道如何解决这个问题。 Here is an example of my cursor when I go back to the line in UWP:下面是我cursor当我go回到UWP那一行的例子:
Options -> Text Editor -> C# -> Tabs :选项->文本编辑器-> C# ->选项卡:
Thanks to those who will try to help me and sorry if my English isn't perfect.感谢那些愿意帮助我的人,如果我的英语不完美,我深表歉意。
There is the chance of changing the indentation settings (among others) on a per-project basis by providing a .editorconfig
file, that will override some settings in Visual Studio project.通过提供.editorconfig
文件,可以在每个项目的基础上更改缩进设置(以及其他),这将覆盖 Visual Studio 项目中的某些设置。 If you're having different behaviors on the same language but different projects, look for such a file and change the setting there.如果您在同一语言但不同的项目上有不同的行为,请查找这样的文件并更改那里的设置。
Welcome to SO.欢迎来到 SO。
You're changing the setting for XAML, but the code you show is C#. Try editing the C# settings instead.您正在更改 XAML 的设置,但您显示的代码是 C#。尝试改为编辑 C# 设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.