【问题标题】:How to set padding or margin of element in code behind in Zebble for Xamarin?如何在 Zebble for Xamarin 中的代码中设置元素的填充或边距?
【发布时间】:2017-04-12 19:05:36
【问题描述】:

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

ProductList.Margin = 10 //Exception

【问题讨论】:

    标签: c# xamarin xamarin-zebble zebble


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

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

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

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

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

      【讨论】:

        猜你喜欢
        • 2017-10-09
        • 2014-07-23
        • 2011-03-14
        • 2015-10-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-06-24
        • 1970-01-01
        相关资源
        最近更新 更多