Exemplo n.º 1
0
 internal override void SetUp(BindableObject bindable)
 {
     if (Binding != null)
     {
         bindable.SetBinding(_boundProperty, Binding.Clone());
     }
 }
Exemplo n.º 2
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.º 3
0
        /// <include file="../../docs/Microsoft.Maui.Controls/BindableObjectExtensions.xml" path="//Member[@MemberName='SetBinding']/Docs" />
        public static void SetBinding(this BindableObject self, BindableProperty targetProperty, string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null,
                                      string stringFormat = null)
        {
            if (self == null)
            {
                throw new ArgumentNullException("self");
            }
            if (targetProperty == null)
            {
                throw new ArgumentNullException("targetProperty");
            }

            var binding = new Binding(path, mode, converter, stringFormat: stringFormat);

            self.SetBinding(targetProperty, binding);
        }
Exemplo n.º 4
0
 /// <include file="../../docs/Microsoft.Maui.Controls/BindableObjectExtensions.xml" path="//Member[@MemberName='SetOnAppTheme']/Docs" />
 public static void SetOnAppTheme <T>(this BindableObject self, BindableProperty targetProperty, T light, T dark) => self.SetBinding(targetProperty, new AppThemeBinding {
     Light = light, Dark = dark
 });