Xamarin.Forms之Frame布局

1.HasShadow属性

可能很多人都不会注意到这个属性,知道在iOS看到Frame默认的那个样子(自带阴影)

通过反编译,找到该属性的定义

/// <summary>Identifies the HasShadow bindable property.</summary>
        /// <remarks />
        public static readonly BindableProperty HasShadowProperty = BindableProperty.Create("HasShadow", typeof(bool), typeof(Frame), true, BindingMode.OneWay, null, null, null, null, null);
HasShadow - true or false, to indicate whether to show a shadow effect where the platform supports it.

实际的结果就是:

iOS:支持该属性,且默认是有阴影的(看上面的定义,HasShadow的默认值为true)

Android:不支持

2.Frame中使用Style

其实跟普通其他控件一样,但是今天遇到一个问题,当在Style中设置Padding的时候,无效,最终发现这是Forms的一个BUG

https://bugzilla.xamarin.com/show_bug.cgi?id=30765

也就是说在Style中设置Frame的Padding是无效的

原文地址:https://www.cnblogs.com/yz1311/p/5554230.html