Wpf : DoubleAnimation mit eigenem "DependencyPropery" verwenden !!



  • Hallo Ihr,

    ich hab eine Animation an ein eigenes DependcyProperty gebunden (siehe code) aber an meinen DependencyProperty rührt sich nich, nach "BeginAnimation"??

    Was mach ich Falsch? (p.s. ich hab Gegooglet, aber konnte da keine lösung finden)

    public Window1()
    		{
    			InitializeComponent();
    
    			DoubleAnimation da = new DoubleAnimation();
    			da.From = DateTime.Now.ToOADate();
    			da.To = DateTime.Now.AddSeconds(10).ToOADate();
    			da.Duration = new Duration(TimeSpan.FromSeconds(5));
    			da.BeginAnimation(Window1.OutputTimeProperty, da);
    
    		}
    
    		public double OutputTime
    		{
    			get { return (double)GetValue(OutputTimeProperty); }
    			set { SetValue(OutputTimeProperty, value); }
    		}
    
    		// Using a DependencyProperty as the backing store for OutputTime.  This enables animation, styling, binding, etc...
    		public static readonly DependencyProperty OutputTimeProperty =
    			DependencyProperty.Register("OutputTime",
    			typeof(double),
    			typeof(Window1),
    			new UIPropertyMetadata(DateTime.MinValue.ToOADate(), new PropertyChangedCallback((a, b) =>
    			{
    				(a as Window1).Output = DateTime.FromOADate((double)b.NewValue).ToString();
    			})));
    

Log in to reply