我新上Xamarin.Forms,我試圖用EntryCell
如何EntryCell添加到Xamrin.Forms內容
AccountId = new EntryCell {Label="Account Id", Text = CustomersPage.staticCustomer.AccountId};
當我嘗試添加到頁面的內容是這樣的:
Content = new StackLayout {
Children = {
AccountId
}
};
我得到這個錯誤:
The best overloaded Add method 'System.Collections.Generic.ICollection.Add(Xamarin.Forms.View)' for the collection initializer has some invalid arguments
爲什麼我不能添加EntryCell
直接就像Entry
?我怎樣才能添加它?
我不認爲EntryCell可以直接插入StackLayout。我相信它屬於一個TableView。請參閱此處的文檔,https://developer.xamarin.com/api/type/Xamarin.Forms.EntryCell/。 – Bearcat9425
@ Bearcat9425謝謝...實際上,現在我做同樣的事情,我使用TableView,但我想知道爲什麼? –