【问题标题】:Can the TableView have multiple headers?TableView 可以有多个标题吗?
【发布时间】:2014-08-10 15:30:22
【问题描述】:

我附上了一张图片。一个tableview可以有多个header并按子模型分组吗?

我的模型结构看起来像这样。

public class ModuleViewModel
{
    public string Title { get; set; }
    public IList<MediaViewModel> Media { get; set; }
}

public class MediaViewModel
{
    public string Title { get; set; }
    public string Icon { get; set; }
    public ModuleSectionViewModel ModuleSection {get; set;}
}

public class ModuleSectionViewModel
{
    public string Title { get; set; }
}
  1. 您在图像中看到的视图是 ModuleView
  2. TableView(滑动导航位)会将其源绑定到 Media 属性
  3. 表格将按 ModuleSection.Title 属性分组

这可能吗?如果是这样,我应该从哪里开始?

为了增加复杂性,我更喜欢在 Xaml 中进行绑定 :)

【问题讨论】:

    标签: xamarin.forms


    【解决方案1】:

    TableView 目前还不能完全绑定。但是您可以通过将其子类化并将TableView.Root 属性分配给OnBindingContextChanged() 覆盖中构造的TableRoot 来获得类似的结果。

    【讨论】:

    • 我不确定这对多个类别/组有什么帮助?我不是怀疑你,只是不知道如何完成它。
    猜你喜欢
    • 2016-04-12
    • 2015-11-04
    • 1970-01-01
    • 2010-12-14
    • 1970-01-01
    • 2020-08-19
    • 2014-01-09
    • 1970-01-01
    • 2017-05-30
    相关资源
    最近更新 更多