簡體   English   中英

在Xamarin C#Visual Studio中創建TableView

[英]Create TableView in Xamarin C# Visual Studio

請參閱下面的代碼,我可能知道這是什么意思...當我復制到Visual Studio的xml項目時,這是錯誤的。

Content = new TableView {
    Root = new TableRoot {
        new TableSection...
    },
    Intent = TableIntent.Settings
};

我假設您是在Xamarin頁面中復制示例。 您面臨的錯誤是您沒有為TableView創建ViewCell。

這是一個可以幫助您入門的工作示例。

var table = new TableView();
table.Intent = TableIntent.Settings;
var layout = new StackLayout() { Orientation = StackOrientation.Horizontal };
layout.Children.Add (new Label() {
    Text = "TestLayout",
    TextColor = Color.FromHex("#f35e20"),
    VerticalOptions = LayoutOptions.Center
});

table.Root = new TableRoot () {
    new TableSection("Getting Started") {
        new ViewCell() {View = layout}
    }
};

Content = table;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM