class MainMenuItem : ViewCell
{
public MainMenuItem(string text, string icon)
{
View = new StackLayout() {
Orientation = StackOrientation.Horizontal,
Spacing = 20,
Padding = 20,
Children = {
new Image() {
Source = ImageSource.FromFile(icon),
VerticalOptions = LayoutOptions.Center,
},
new Label() {
Text = text,
VerticalOptions = LayoutOptions.Center,
Font = Font.BoldSystemFontOfSize(25)
}
}
};
}
}
var menu = new TableView {
Intent = TableIntent.Menu,
Root = new TableRoot {
new TableSection("Menu")
{
new MainMenuItem("Item1", "test.png")
{
Command = new Command(async () => { }) // DOESN'T WORK - compiler error ???
},
new ImageCell()
{
ImageSource = ImageSource.FromFile("test.png"),
Text = "Item1",
Detail = "Details",
Command = new Command(async () => { }) // OK !!!
}
}
}
};
Can You explain why it won't compile? What is ViewCell.Tapped Event? How is it different from Command?