[英]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.