示例#1
0
文件: Setter.cs 项目: wonrst/TizenFX
        internal void UnApply(BindableObject target, bool fromStyle = false)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (Property == null)
            {
                return;
            }

            object actual = target.GetValue(Property);

            if (!Equals(actual, Value) && !(Value is Tizen.NUI.Binding.Binding) && !(Value is DynamicResource))
            {
                //Do not reset default value if the value has been changed
                originalValues.Remove(target);
                return;
            }

            object defaultValue;

            if (originalValues.TryGetValue(target, out defaultValue))
            {
                //reset default value, unapply bindings and dynamicResource
                target.SetValue(Property, defaultValue, fromStyle);
                originalValues.Remove(target);
            }
            else
            {
                target.ClearValue(Property);
            }
        }
示例#2
0
 internal override void TearDown(BindableObject bindable)
 {
     bindable.ClearValue(stateProperty);
     bindable.PropertyChanged -= OnAttachedObjectPropertyChanged;
 }
示例#3
0
 internal override void TearDown(BindableObject bindable)
 {
     bindable.RemoveBinding(boundProperty);
     bindable.ClearValue(boundProperty);
 }