简体   繁体   English

Xamarin.Forms:C#与XAML中的视图

[英]Xamarin.Forms: View in C# vs. XAML

I've inherited a Xamarin.Forms app which creates some of the views in C# rather than XAML. 我继承了Xamarin.Forms应用程序,该应用程序在C#中创建了一些视图,而不是XAML。 Is there any clear advantage to moving these views to XAML? 将这些视图移至XAML有明显的优势吗?

It is based on personal preference, but in general and to follow the standards putting in mind that other developers might work on that project in the future, it is recommended to use XAML. 它基于个人喜好,但是总的来说,为了遵循遵循标准的考虑,将来其他开发人员可能会在该项目上工作,建议使用XAML。

XAML is easier to maintain and modify, helps with a clear separation of concerns between the UI and logic, well suited for use with the popular MVVM (Model-View-ViewModel) application architecture , and tooling friendly as there is a XAML Previewer which allows you to see your Xamarin.Forms layouts rendered as you type. XAML易于维护和修改,有助于将UI和逻辑之间的关注点明确分离, 非常适合与流行的MVVM(Model-View-ViewModel)应用程序体系结构一起使用 ,并且工具友好,因为XAML Previewer允许您将看到键入时呈现的Xamarin.Forms布局。

UPDATE 更新

You can drag-and-drop Xamarin.Forms controls from the toolbox to the XAML editing surface as of Visual Studio 2017 version 15.8 Preview 4. 从Visual Studio 2017版本15.8 Preview 4开始,您可以将Xamarin.Forms控件从工具箱拖放到XAML编辑表面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xamarin.Forms:C#代码与XAML代码 - Xamarin.Forms: C# code vs XAML code 如何在 Xamarin.Z64502425319129281C3683CAE8A8 中的 XAML 中使用 C# 变量的值? - How to use value of a C# variable in XAML in Xamarin.Forms? Xamarin.Forms:绑定到 C#(不是 XAML)中的整个 BindingConext - Xamarin.Forms: Binding to Entire BindingConext in C# (not XAML) 使用 Xamarin.Forms(xaml 和 c#)创建超链接 - Create a hyperlink using Xamarin.Forms (xaml and c#) iOS App(Xamarin)与iOS XAML App(Xamarin.Forms)与跨平台之间的区别是什么 - What are diffs between iOS App (Xamarin) vs. iOS XAML App (Xamarin.Forms) vs. Cross-Platform Xamarin.Forms-C#代码中的视图到视图绑定? - Xamarin.Forms - View-To-View Bindings In C# Code? 如何在其控制器中投射 XAML 项目? [C#],[Xamarin.Forms] - How do I cast an XAML item in its controller? [C#],[Xamarin.Forms] 有没有办法将元素的 xaml 属性绑定到由代码创建的新元素? (c# xamarin.forms) - Is there a way to bind the xaml properties of an element to a new element created by code? (c# xamarin.forms) 如果我可以在C#文件中完成所有工作,为什么还要在Xamarin.Forms项目中使用Xaml标记? - Why use Xaml markup in Xamarin.Forms projects if i can do all job in C# file? 如何使用C#代码和XAML在xamarin.forms中使用成语 - how to use Idioms in xamarin.forms using C# code and XAML
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM