コード例 #1
0
ファイル: XamlStyle.cs プロジェクト: wonrst/TizenFX
 bool ValidateBasedOn(XamlStyle value)
 {
     if (value == null)
     {
         return(true);
     }
     return(value.TargetType.IsAssignableFrom(TargetType));
 }
コード例 #2
0
ファイル: XamlStyle.cs プロジェクト: wonrst/TizenFX
        static void OnBasedOnResourceChanged(BindableObject bindable, object oldValue, object newValue)
        {
            XamlStyle style = (bindable as View)?.XamlStyle;

            if (style == null)
            {
                return;
            }
            style.UnApplyCore(bindable, (XamlStyle)oldValue);
            style.ApplyCore(bindable, (XamlStyle)newValue);
        }
コード例 #3
0
ファイル: XamlStyle.cs プロジェクト: wonrst/TizenFX
        void UnApplyCore(BindableObject bindable, XamlStyle basedOn)
        {
            ((AttachedCollection <TriggerBase>)Triggers).DetachFrom(bindable);
            ((AttachedCollection <Behavior>)Behaviors).DetachFrom(bindable);
            foreach (Setter setter in Setters)
            {
                setter.UnApply(bindable, true);
            }

            if (basedOn != null)
            {
                ((IStyle)basedOn).UnApply(bindable);
            }
        }
コード例 #4
0
ファイル: XamlStyle.cs プロジェクト: wonrst/TizenFX
        void BasedOnChanged(XamlStyle oldValue, XamlStyle newValue)
        {
            foreach (WeakReference <BindableObject> bindableRef in targets)
            {
                BindableObject bindable;
                if (!bindableRef.TryGetTarget(out bindable))
                {
                    continue;
                }

                UnApplyCore(bindable, oldValue);
                ApplyCore(bindable, newValue);
            }
        }
コード例 #5
0
ファイル: XamlStyle.cs プロジェクト: wonrst/TizenFX
        void ApplyCore(BindableObject bindable, XamlStyle basedOn)
        {
            if (basedOn != null)
            {
                ((IStyle)basedOn).Apply(bindable);
            }

            foreach (Setter setter in Setters)
            {
                setter.Apply(bindable, true);
            }
            ((AttachedCollection <Behavior>)Behaviors).AttachTo(bindable);
            ((AttachedCollection <TriggerBase>)Triggers).AttachTo(bindable);
        }
コード例 #6
0
 internal void Add(XamlStyle style)
 {
     if (string.IsNullOrEmpty(style.Class))
     {
         Add(style.TargetType.FullName, style);
     }
     else
     {
         IList <XamlStyle> classes;
         object            outclasses;
         if (!TryGetValue(XamlStyle.StyleClassPrefix + style.Class, out outclasses) || (classes = outclasses as IList <XamlStyle>) == null)
         {
             classes = new List <XamlStyle>();
         }
         classes.Add(style);
         this[XamlStyle.StyleClassPrefix + style.Class] = classes;
     }
 }