如何在XAML中创建的另一个ViewCell之后添加ViewCell(在C#中创建)?

时间:2017-08-24 02:43:22

标签: xamarin xamarin.forms

我有这个XAML:

 <dom-module id="my-view2">
    <template>
      <my-options></my-options>
    </template>
    ...
 </dom-module>

C#

<TableSection x:Name="TS2">
   <TableSection.Title>
      ABC
   </TableSection.Title>
   <ViewCell x:Name="noa" Tapped="openPicker">
                    ...
   </ViewCell>
   <ViewCell x:Name="prt" Tapped="openPicker">
                    ...
   </ViewCell>
</TableSection>

如何在C#中的第二个ViewCell之后添加一个ViewCell(从新的TableViewFooter(&#34; AAA&#34;,60)创建)。

public partial class TableViewFooter : ViewCell
{
    public TableViewFooter()
    {
        InitializeComponent();
    }
}

这段代码是错误的说法:

  

错误CS7036:没有给出与...对应的参数   所需的形式参数&#39;值&#39;的   &#39; SettersExtensions.Add(IList,BindableProperty,object)&#39;   (CS7036)

1 个答案:

答案 0 :(得分:2)

您无法将ViewCell添加到ViewCell - 但您可以将其附加到TableSection - 例如,尝试使用:

TS2.Add(cmt);