Hi,
I´m beginner. I have this code, but label with price is´nt on the right.
`
public class DishCell: ViewCell
{ public static int count = 1;
public DishCell ()
{
var menuLayout = CreateMenuLayout();
var viewLayout = new StackLayout()
{
Orientation = StackOrientation.Vertical,
Children = { menuLayout }
};
View = viewLayout;
count++;
}
static StackLayout CreateMenuLayout()
{
var weightLabel = new Label ()
{
HorizontalOptions = LayoutOptions.End,
TextColor = Color.Black,
Font = Font.SystemFontOfSize(14)
};
weightLabel.SetBinding(Label.TextProperty, "Weight");
var dishLabel = new Label
{
WidthRequest = 140,
HeightRequest = 40,
TextColor = Color.Black,
Font = Font.SystemFontOfSize(14)
};
dishLabel.SetBinding(Label.TextProperty, "Dish");
var priceLabel = new Label()
{
HorizontalOptions = LayoutOptions.FillAndExpand,
TextColor = Color.Black,
Font = Font.BoldSystemFontOfSize(14),
//XAlign = TextAlignment.End, //ovlivnuje zarovnani
};
priceLabel.SetBinding (Label.TextProperty, "Price");
var row = new StackLayout()
{
Orientation = StackOrientation.Horizontal,
Spacing = 20,
Padding = new Thickness(10,10,10,10),
Children = { weightLabel, dishLabel, priceLabel }
};
if(count % 2 == 0)
{
row.BackgroundColor = Color.White;
}
else
{
row.BackgroundColor = Color.FromHex("ebebeb");
}
return row;
}
}
`