Ejemplo n.º 1
0
        public static void SetImmediate(this VisualElement element, Action setterBlock)
        {
            if (element is null)
            {
                throw new ArgumentNullException(nameof(element));
            }
            if (setterBlock is null)
            {
                throw new ArgumentNullException(nameof(setterBlock));
            }


            var transitions = (TransitionCollection)element.GetValue(TransitionsProperty);

            try
            {
                foreach (var t in transitions ?? Enumerable.Empty <TransitionBase>())
                {
                    t.IsDisabled = true;
                }
                element.BatchBegin();

                setterBlock();
            }
            finally
            {
                element.BatchCommit();
                foreach (var t in transitions ?? Enumerable.Empty <TransitionBase>())
                {
                    t.IsDisabled = false;
                }
            }
        }
Ejemplo n.º 2
0
        public static void ClearTransforms(this VisualElement visualElement)
        {
            visualElement.AbortAnimation("");

            visualElement.BatchBegin();
            visualElement.Opacity      = 1;
            visualElement.TranslationX = 0;
            visualElement.TranslationY = 0;
            visualElement.Rotation     = 0;
            visualElement.Scale        = 1;
            visualElement.RotationX    = 0;
            visualElement.RotationY    = 0;
            visualElement.BatchCommit();
        }
Ejemplo n.º 3
0
        public static void ClearTransforms(this VisualElement visualElement, int opacity = 1)
        {
            visualElement.AbortAnimation(visualElement.Id.ToString());

            visualElement.BatchBegin();
            visualElement.Opacity      = opacity;
            visualElement.TranslationX = 0;
            visualElement.TranslationY = 0;
            visualElement.Rotation     = 0;
            visualElement.Scale        = 1;
            visualElement.RotationX    = 0;
            visualElement.RotationY    = 0;
            visualElement.AnchorX      = 0.5;
            visualElement.AnchorY      = 0.5;
            visualElement.BatchCommit();
        }
Ejemplo n.º 4
0
        public static void SetImmediate(this VisualElement element, Action setterBlock)
        {
            var transitions = (TransitionCollection)element.GetValue(TransitionsProperty);

            try
            {
                foreach (var t in transitions ?? Enumerable.Empty <TransitionBase>())
                {
                    t.IsDisabled = true;
                }
                element.BatchBegin();

                setterBlock();
            }
            finally
            {
                element.BatchCommit();
                foreach (var t in transitions ?? Enumerable.Empty <TransitionBase>())
                {
                    t.IsDisabled = false;
                }
            }
        }