C# 获取表节上的条目数
如果我得到这个int 我可以设置桌子的正确高度 所以我试着:C# 获取表节上的条目数,c#,ios,c#-4.0,xamarin.forms,tableviewcell,C#,Ios,C# 4.0,Xamarin.forms,Tableviewcell,如果我得到这个int 我可以设置桌子的正确高度 所以我试着: public class Test : ContentPage{ {...} tableTest = new TableView { Intent = TableIntent.Data, BackgroundColor = Colors.WhiteTranslucent,
public class Test : ContentPage{
{...}
tableTest = new TableView {
Intent = TableIntent.Data,
BackgroundColor = Colors.WhiteTranslucent,
RowHeight = 40,
Root = new TableRoot {
new TableSection () {
new TextCell { Text = "Contato 1", TextColor = Color.Black, },
new TextCell { Text = "Contato 2", TextColor = Color.Black, },
},
},
};
layout.Children.Add (tableTest,
xConstraint: Constraint.RelativeToParent ((parent) => 0),
yConstraint: Constraint.RelativeToParent ((parent) => 150),
widthConstraint: Constraint.RelativeToParent ((parent) => parent.Width),
**heightConstraint: Constraint.RelativeToParent ((parent) => **(*GetEntryCell (0,0).* * contacts.RowHeight))**
);
{...}
TableSection GetEntryCell (int row, int column)
{
return (TableSection)contacts.Root [row] [column];
}
}
但是我没有电话号码
将来我会得到它,因为我会去BD。
因为我需要一个解决方案
我使用此选项访问表:
TableSection GetEntryCell (int row, int column);
也许我不理解这个问题,但是
tableTest.Root.Count
将为您提供TableView中的节数,tableTest.Root[0]。Count
将为您提供节中的项目数