Problem with WPF animation.Duration= and TimeSpan

Hi all,

Once again I am hitting some unexpected behavior in IronRuby. Might be a
bug
:wink:

animation = System::Windows::Media::Animation::DoubleAnimation.new()
=> #System::Windows::Media::Animation::DoubleAnimation:0x000005c

animation.Duration= System::Windows::Duration.new(
System::TimeSpan.FromSeconds(2))
=> #System::Windows::Duration:0x000005e

animation.Duration= System::Windows::Duration.Forever
=> #System::Windows::Duration:0x0000060

So far everything works as expected. Now trying to directly set a
timespan
which should be possible in C#:

animation.Duration= System::TimeSpan.FromSeconds(2)
:0: can’t convert System::TimeSpan into System::Windows::Duration
(TypeError)

ok, automatic conversion seems not yet to work here … but the next
thing
is really strange:

animation.Duration= System::Windows::Duration.new(
System::TimeSpan.FromSeconds(2))
:0: can’t convert System::TimeSpan into System::Windows::Duration
(TypeError)

animation.Duration= System::Windows::Duration.Forever
:0: can’t convert System::TimeSpan into System::Windows::Duration
(TypeError)

???

What has already worked now doesn’t any more, depending on the value
that
has been set before. You will probably know what is going on.

Cheers,
– henon

Crazy. I’ve opened a bug:
http://rubyforge.org/tracker/index.php?func=detail&aid=23953&group_id=4359&atid=16798

~js

From: [email protected]
[mailto:[email protected]] On Behalf Of Meinrad
Recheis
Sent: Monday, February 16, 2009 6:34 AM
To: ironruby-core
Subject: [Ironruby-core] problem with WPF animation.Duration= and
TimeSpan

Hi all,

Once again I am hitting some unexpected behavior in IronRuby. Might be a
bug :wink:

animation = System::Windows::Media::Animation::DoubleAnimation.new()
=> #System::Windows::Media::Animation::DoubleAnimation:0x000005c

animation.Duration= System::Windows::Duration.new( System::TimeSpan.FromSeconds(2))
=> #System::Windows::Duration:0x000005e

animation.Duration= System::Windows::Duration.Forever
=> #System::Windows::Duration:0x0000060

So far everything works as expected. Now trying to directly set a
timespan which should be possible in C#:

animation.Duration= System::TimeSpan.FromSeconds(2)
:0: can’t convert System::TimeSpan into System::Windows::Duration
(TypeError)

ok, automatic conversion seems not yet to work here … but the next
thing is really strange:

animation.Duration= System::Windows::Duration.new( System::TimeSpan.FromSeconds(2))
:0: can’t convert System::TimeSpan into System::Windows::Duration
(TypeError)

animation.Duration= System::Windows::Duration.Forever
:0: can’t convert System::TimeSpan into System::Windows::Duration
(TypeError)

???

What has already worked now doesn’t any more, depending on the value
that has been set before. You will probably know what is going on.

Cheers,
– henon