繁体   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