![](/img/trans.png)
[英]Is there any way that I can speed up the adding of new elements to a page when using the C# back end?
[英]When creating a template is there any reason to have a back end C# initializer?
我的應用程序中有以下示例:
<?xml version="1.0" encoding="utf-8"?>
<Grid xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:J;assembly=J"
x:Class="J.Templates.HelpGrid"
Padding="15"
RowSpacing="10"
ColumnSpacing="10" />
和在C#中
using System;
using System.Collections.Generic;
using Xamarin.Forms;
namespace J.Templates
{
public partial class HelpGrid : Grid
{
public HelpGrid()
{
InitializeComponent();
}
}
}
從我看到的代碼可以正常工作,我可以使用該模板,而無需編寫或不編寫后端c#。
開發人員可能有任何理由選擇添加后端C#代碼嗎?
編譯器需要后備類(c#文件)才能工作,這時您無法避免。
從理論上講,可以消除對支持類的需求,但這並不是一件容易的事。
他們可以在編譯管道中添加新任務,但這會大大降低構建速度(xaml越多,速度越慢)。
最后,收益很少,還有很多工作,這是不值得的。
您可以在這里閱讀Xamarin工作人員的完整說明: https : //github.com/xamarin/Xamarin.Forms/issues/4327#issuecomment-436921856
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.