如何在 Zebble for Xamarin 的代码后面设置元素的填充或边距?

How to set padding or margin of element in code behind in Zebble for Xamarin?

我按照下面的代码设置了它,但是没有用。

ProductList.Margin = 10 //Exception

如果 ProductListView 您可以像这样更改其填充和边距:

ProductList.Css.Padding = 10;
ProductList.Css.Margin = 20;

或者,您可以使用提供流畅 API 的扩展方法(因为它们 return 返回对象),如下所示:

ProductList.Padding(10).Margin(20);

这些扩展方法也允许您设置特定的边。例如:

ProductList.Padding(top: 10, right: 15)
           .Margin(vertical: 20); // <-- this sets both top and bottom