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))); }
/// <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); }
internal static bool GetLoadAsAnimation(BindableObject bindable) { return(bindable.IsSet(IsAnimationPlayingProperty)); }