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



我像下面的代码一样设置它,但它不起作用。

ProductList.Margin = 10 //Exception
如果

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

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

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

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

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

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