コード例 #1
0
        public static BehaviourCollection GetCollection(FrameworkElement frameworkElement)
        {
            if (!(frameworkElement.GetValue(BehavioursProperty) is BehaviourCollection collection))
            {
                collection = new BehaviourCollection();

                collection.Apply(frameworkElement);
            }

            return(collection);
        }
コード例 #2
0
        public static void SetCollection(FrameworkElement frameworkElement, BehaviourCollection collection)
        {
            if (frameworkElement.GetValue(BehavioursProperty) is BehaviourCollection oldCollection)
            {
                oldCollection.Apply(null);
            }

            frameworkElement.SetValue(BehavioursProperty, collection);

            collection.Apply(frameworkElement);
        }