예제 #1
0
        BindablePropertyContext GetOrCreateContext(BindableProperty property)
        {
            BindablePropertyContext context = GetContext(property);

            if (context == null)
            {
                context = CreateAndAddContext(property);
            }
            else if (property.ValueGetter != null)
            {
                context.Value = property.ValueGetter(this);         //Update Value from dali
            }//added by xiaohui.fang
            else if (property.DefaultValueCreator != null)          //This will be removed in the future.
            {
                context.Value = property.DefaultValueCreator(this); //Update Value from dali
            }//added by xb.teng

            return(context);
        }
예제 #2
0
        public object GetValue(BindableProperty property)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            if (!IsBinded && property.ValueGetter != null)
            {
                return(property.ValueGetter(this));
            }

            BindablePropertyContext context = property.DefaultValueCreator != null?GetOrCreateContext(property) : GetContext(property);

            if (context == null)
            {
                return(property.DefaultValue);
            }

            return(context.Value);
        }