Ejemplo n.º 1
0
 internal static void ApplyValue(DependencyObject target, PropertyPath propertyPath, object value, bool isVisualStateChange)
 {
     if (isVisualStateChange)
     {
         propertyPath.INTERNAL_PropertySetVisualState(target, value);
     }
     else
     {
         propertyPath.INTERNAL_PropertySetAnimationValue(target, value);
     }
 }
Ejemplo n.º 2
0
 internal static void ApplyInstantAnimation(DependencyObject target, PropertyPath propertyPath, double to, bool isVisualStateChange)
 {
     if (isVisualStateChange)
     {
         propertyPath.INTERNAL_PropertySetVisualState(target, to);
     }
     else
     {
         propertyPath.INTERNAL_PropertySetLocalValue(target, to);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Removes the value set for the VisualState on the specified frameworkElement.
        /// </summary>
        /// <param name="frameworkElement"></param>
        internal void UnApply(FrameworkElement frameworkElement)
        {
            DependencyObject target       = default(DependencyObject);
            PropertyPath     propertyPath = default(PropertyPath);
            Control          frameworkElementAsControl = frameworkElement as Control;

            if (frameworkElementAsControl != null)
            {
                GetTargetElementAndPropertyInfo(frameworkElement, out target, out propertyPath);
                //DependencyObject lastElementBeforeProperty = propertyPath.INTERNAL_AccessPropertyContainer(target);
                propertyPath.INTERNAL_PropertySetVisualState(target, CSHTML5.Internal.INTERNAL_NoValue.NoValue);
            }
        }
        private void ApplyKeyFrame(DependencyObject target, IterationParameters parameters, PropertyPath propertyPath, Type propertyType, ObjectKeyFrame keyFrame, DispatcherTimer timer)
        {
            if (timer != null)
            {
                timer.Stop();
            }
            _keyFramesToObjectTimers.Remove(keyFrame);
            object value = keyFrame.Value;

            if (value is string && propertyType != typeof(string))
            {
                if (propertyType.IsEnum)
                {
                    value = Enum.Parse(propertyType, (string)value);
                }
                else
                {
                    //we convert the value from the given string:
                    value = DotNetForHtml5.Core.TypeFromStringConverters.ConvertFromInvariantString(propertyType, (string)value);
                }
            }

            var castedValue = DynamicCast(value, propertyType); //Note: we put this line here because the Xaml could use a Color gotten from a StaticResource (which was therefore not converted to a SolidColorbrush by the compiler in the .g.cs file) and led to a wrong type set in a property (Color value in a property of type Brush).

            if (parameters.IsVisualStateChange)
            {
                propertyPath.INTERNAL_PropertySetVisualState(target, castedValue);
            }
            else
            {
                propertyPath.INTERNAL_PropertySetLocalValue(target, castedValue);
            }

            CheckTimeLineEndAndRaiseCompletedEvent(parameters);

            //----------------------------------------
            //todo:clone required ?
            //----------------------------------------
        }