有 ASP.NET MVC 的图形设计器吗?

发布于 2024-10-31 11:31:30 字数 368 浏览 4 评论 0原文

我想大多数使用 Visual Studio 的人在创建第一个 ASP.NET MVC 项目时都会有同样的反应:设计视图最终去了哪里?

当在 Visual Studio 中使用经典 Web 窗体开发应用程序时,设计视图非常方便,它可以帮助您通过简单地从工具箱中拖放项目来在网页中创建用户控件和其他组件到设计页面。尽管它不像 Dreamweaver 那样允许定位和高级样式,但如果您想避免痛苦的 HTML 格式化和 CSS 样式(或者您对 HTML 没有很好的了解),那么它是一个非常有用的功能。

有没有办法使用图形设计器来创建视图布局,然后将设计与视图的“逻辑”部分(使用模型从控制器填充数据或向控制器提交数据的部分)集成?

I guess that most people that use Visual Studio had my same reaction when they created their first ASP.NET MVC project: where did the Design View end up?

When using classic Web Forms to develop an application in Visual Studio, the Design View is really handy, it helps you to create user controls and other components in your webpage by simply drag and dropping the item from the toolbox to the design page. Although it does not allow positioning and advanced styling, as Dreamweaver does instead, it is a really useful feature if you want to avoid painful HTML formatting and CSS styling (or you do not have good knowledge of HTML).

Is there any way to use a graphic designer to create the View layout and then integrate the design with the "logic" part of the View (the one that uses the model to populate/submit the data from/to the controller)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

病毒体 2024-11-07 11:31:30

我猜大多数使用 Visual Studio 的人在创建第一个 ASP.NET MVC 项目时都会有同样的反应:设计视图最终去了哪里?

一点也不。就我个人而言,我从未在经典 Web 表单中使用过设计视图,当我迁移到 MVC 时,它并没有真正产生任何区别。不仅如此,再使用它也没有任何意义了。我很高兴没有设计师再乱搞我的代码了。我对智能感知已经够头疼的了,如果你使用一个接触幕后代码的设计器,事情就会变得混乱。我所需要的只是运行 Intellisense,它可以完成标签并完美地理解 HTML5。

就设计网页而言,您可以查看表达式工具

I guess that most people that use Visual Studio had my same reaction when they created their first ASP.NET MVC project: where did the Design View end up?

Not at all. Personally I never used the design view in classic web forms and when I migrated to MVC it didn't really make any difference. And not only this, it doesn't make any sense to use it anymore. I am very happy that there is no designer messing with my code anymore. I have enough headaches with Intellisense, if you use a designer which touches the code behind the scenes things will get messy. All I need is working Intellisense which completes the tags and ideally understands HTML5.

As far as designing web pages is concerned you may take a look at the Expression tools.

樱娆 2024-11-07 11:31:30

是的,我有同样的反应,来自网络表单背景。我需要图形设计师的不断反馈,让我知道我的代码产生了什么效果。学习 MVC 本身就是一个足够大的学习曲线,而不必盲目地进行。

现在已经过去了 4 年,我不介意说 Page Inspector 内置于 VS 2013 中。如果您在 2015 年仍在使用 VS 2010,我只能说,如果您升级,您将永远不会回头。

只需右键单击代码并选择在页面检查器中查看。检查器中有一个“检查”按钮,您可以使用它来查看设计元素在代码中的位置。它可以节省您的美容时间。

编辑

看起来他们从 Visual Studio 2015 中删除了它,甚至懒得发布解释原因。嗯...如果我找到第三方解决方案,我会更新此内容。

Yes, I had that same reaction, coming from a webforms background. I need the constant feedback of a graphical designer to let me know what effect my code is having. Learning MVC is a big enough learning curve in and of itself without having to do it blindfolded.

Now that it's 4 years later, I don't mind saying Page Inspector is built in to VS 2013. If you're still using VS 2010 in 2015, all I can say is, if you upgrade, you'll never look back.

Just right click on the code and choose View in Page Inspector. There's an Inspect button in the inspector that you can use to see where an element of the design is located in the code. It can save you beaucoup time.

EDIT

And it looks like they removed it from Visual Studio 2015 and didn't even bother to post an explanation as to why. Smh...I'll update this if I find a 3rd party solution.

暮年慕年 2024-11-07 11:31:30

我认为他们正在将其作为 Expression Blend 5 开发者预览版

他们清楚地认识到在设计器中设计 JS 的问题,因此我怀疑他们也意识到这同样适用于一些从事 MVC 应用程序的设计器。

Microsoft 的某人告诉我“我认为在 Blend for HTML 中,使用交互模式,您可能可以很好地设计 MVC 或 MVVM 模式”

另请查看 Visual Studio Page Inspector 看起来它将执行所需的操作

现在将 WebEssentials 与 BrowserLink(VS2013 或更高版本)

I think they are working on that as a feature for Expression Blend 5 Developer Preview .

They clearly recognise the issue of designing JS in the designer so I suspect they realise the same applies to some designers working on MVC applications.

I was told by someone from Microsoft "I think in Blend for HTML, using interactive mode, you would probably be just fine with designing MVC or MVVM patterns"

Also check out Visual Studio Page Inspector it looks like it will do what is needed

Now use WebEssentials with BrowserLink in VS2013 or up

沉溺在你眼里的海 2024-11-07 11:31:30

如果您正在寻找设计人员来获得 HTML/cshtml 更改的即时反馈,这可以通过 Visual Studio 中的 BrowserLink 功能来实现。启动浏览器并点击您当前正在设计的页面/视图,当您对标记/cshtml 进行任何更改时,点击 Visual Studio 中的刷新按钮,对代码所做的更新将立即推送到浏览器。

其他替代方案是使用 Chrome 开发人员工具 (F12) 并使用“编辑为 Html”功能。

我知道这些替代方案不如 Visual Studio 中的本机设计器视图支持丰富,但这些是一些实用的解决方法。

If you are looking for designer to get instant feedback of the HTML/cshtml changes, this can be achieved by BrowserLink feature in Visual Studio. Fire the browser and hit the page/view you are currently designing and when you make any changes to the mark up/cshtml, hit the refresh button within Visual Studio, updates made to the code will be immediately pushed to browser.

Other alternate is to use Chrome Developer tools (F12) and using "Edit as Html" feature.

I know these alternates are not rich as native designer view support in Visual Studio, but these are some practical workarounds.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文