【发布时间】:2020-05-19 03:51:32
【问题描述】:
我正在尝试将同一页面用于 TabbedPage 中的 3 个选项卡。但是每个选项卡必须在列表视图中显示不同的数据。有没有办法为每个标签设置一个参数?
例子
<local:Sales Title="Pending"
Icon="ic_shortcut_home.png"
ClassId="pending"/>
<local:Sales Title="Posted"
Icon="ic_shortcut_home.png"
ClassId="posted"/>
<local:Sales Title="Uploaded"
Icon="ic_shortcut_home.png"
ClassId="uploaded"/>
我尝试使用 ClassId 和 Title 来获得它们的区别,但我在 Sales 类构造函数中检索 ClassId 时遇到问题,还有其他方法可以获得我想要的输出吗?
public Sales()
{
InitializeComponent();
BindingContext = this;
salesCollection = new ObservableCollection<Head>();
initLvw();
Console.WriteLine(Title); //returns null
Console.WriteLine(ClassId); // returns null
}
【问题讨论】: