Exemplo n.º 1
0
        static void BindProperty(BindableObject content, BindableProperty property, Type type)
        {
            if (content.IsSet(property) || content.GetIsBound(property))
            {
                // Don't override the property if user has already set it
                return;
            }

            content.SetBinding(property,
                               new Binding(property.PropertyName,
                                           source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, type)));
        }
Exemplo n.º 2
0
        /// <include file="../../docs/Microsoft.Maui.Controls/BindableObjectExtensions.xml" path="//Member[@MemberName='GetPropertyIfSet']/Docs" />
        public static T GetPropertyIfSet <T>(this BindableObject bindableObject, BindableProperty bindableProperty, T returnIfNotSet)
        {
            if (bindableObject == null)
            {
                return(returnIfNotSet);
            }

            if (bindableObject.IsSet(bindableProperty))
            {
                return((T)bindableObject.GetValue(bindableProperty));
            }

            return(returnIfNotSet);
        }
Exemplo n.º 3
0
 internal static bool GetLoadAsAnimation(BindableObject bindable)
 {
     return(bindable.IsSet(IsAnimationPlayingProperty));
 }