Ejemplo n.º 1
0
            internal void SetActive(bool active)
            {
                if (_isInitializing)
                {
                    afterInit = () => SetActive(active);
                    return;
                }
                if (Storyboard != null)
                {
                    if (active)
                    {
                        Storyboard.Begin();
                    }
                    else
                    {
                        Storyboard.Stop();
                    }
                }

                //var storyboard = new System.Windows.Media.Animation.Storyboard();
                foreach (var setter in _setters.OfType <System.Windows.Setter>())
                {
                    System.Windows.DependencyProperty property = setter.Property;
                    object value      = setter.Value;                //Why doesn't this  return the actual value???
                    string targetName = setter.TargetName;

                    //var s = new System.Windows.Media.Animation.DoubleAnimation() { };
                    //System.Windows.Media.Animation.Storyboard.SetTargetName(s, setter.TargetName);
                    //System.Windows.Media.Animation.Storyboard.SetTargetProperty(s, new System.Windows.PropertyPath(string.Format("({0}.{1})", setter.Property.OwnerType.Name, setter.Property.Name )));
                    //s.To = (double)setter.Value;
                    //storyboard.Children.Add(s);

                    //This isn't really working... need a better way
                    //if (System.Windows.Application.Current.MainWindow != null)
                    //{
                    //	if (System.Windows.Application.Current.MainWindow.IsLoaded)
                    //	{
                    //		var target = System.Windows.Application.Current.MainWindow.FindName(targetName) as System.Windows.DependencyObject;
                    //		if (target != null)
                    //			target.SetValue(property, value);
                    //	}
                    //	else
                    //		System.Windows.Application.Current.MainWindow.Loaded += (s, e) =>
                    //		{
                    //			var target = System.Windows.Application.Current.MainWindow.FindName(targetName) as System.Windows.DependencyObject;
                    //			if (target != null)
                    //				target.SetValue(property, value);
                    //		};
                    //}
                }
                //storyboard.Begin()
            }