Xamarin View获取属性的绑定信息

        public static Binding GetBinding( BindableObject self, BindableProperty property)
        {
            var methodInfo = typeof(BindableObject).GetTypeInfo().GetDeclaredMethod("GetContext");
            var context = methodInfo?.Invoke(self, new[] { property });

            var propertyInfo = context?.GetType().GetTypeInfo().GetDeclaredField("Binding");
            return propertyInfo?.GetValue(context) as Binding;
        }

 

posted @ 2018-08-24 15:38  IWing  阅读(229)  评论(0编辑  收藏  举报