GetTargetName() public static method

public static GetTargetName ( [ element ) : string
element [
return string
        internal static void SetValueBypassPropagation(this Timeline timeline, object value)
        {
            if (timeline.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug))
            {
                timeline.Log().DebugFormat("Setting [{0}] to [{1} / {2}] and bypassing native propagation", value, Storyboard.GetTargetName(timeline), Storyboard.GetTargetProperty(timeline));
            }

            var animatedItem = timeline.PropertyInfo.GetPathItems().Last();

            using (
                DependencyObjectStore.BypassPropagation(
                    (DependencyObject)animatedItem.DataContext,
                    DependencyProperty.GetProperty(animatedItem.DataContext.GetType(), animatedItem.PropertyName)
                    )
                )
            {
                timeline.PropertyInfo.Value = value;
            }
        }
Esempio n. 2
0
 internal static string GetTimelineTargetFullName(this Timeline t)
 {
     return(Storyboard.GetTargetName(t) + "." + Storyboard.GetTargetProperty(t));
 }
        internal static void SetValueBypassPropagation(this Timeline timeline, object value)
        {
            if (timeline.Log().IsEnabled(Uno.Foundation.Logging.LogLevel.Debug))
            {
                timeline.Log().DebugFormat("Setting [{0}] to [{1} / {2}] and bypassing native propagation", value, Storyboard.GetTargetName(timeline), Storyboard.GetTargetProperty(timeline));
            }

            var animatedItem = timeline.PropertyInfo.GetPathItems().Last();

            // Get the property name from the last part of the
            // specified name (for dotted paths, if they exist)
            var propertyName = animatedItem.PropertyName.Split(new[] { '.' }).Last().Replace("(", "").Replace(")", "");

            var dc = animatedItem.DataContext;

            using (dc != null ?
                   DependencyObjectStore.BypassPropagation(
                       (DependencyObject)dc,
                       DependencyProperty.GetProperty(dc.GetType(), propertyName)
                       ) :
                   // DC may have been collected since it's weakly held
                   null
                   )
            {
                timeline.PropertyInfo.Value = value;
            }
        }