1

I've just downloaded source code of a Silverlight app and figured out happily that there seems to be only one error keeping me from compiling it:


private void UserControl_LostFocus(object sender, RoutedEventArgs e)
{
  object o = e.Source;
}

there seems to be no Source in RoutedEventArgs despite the fact the documentation says it's there.

Any idea where has RoutedEventArgs.Source gone?

Ivan
  • 63,011
  • 101
  • 250
  • 382

1 Answers1

2

It doesn't exist in Silverlight - only in the desktop framework.

If you look at the Silverlight RoutedEventArgs documentation you'll see there are fewer members than for the desktop .NET 4 version.

H H
  • 263,252
  • 30
  • 330
  • 514
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Then how could it be intended to work? I've got a working binary version of this app (works well as a usual Silverlight browser applet) and this source code... – Ivan Aug 07 '11 at 15:43
  • @Ivan: That seems odd to me, as it's clearly *not* documented to be present in Silverlight. Does the binary version *really* refer to `Source`? – Jon Skeet Aug 07 '11 at 15:45
  • I even can't understand why would it need it as it seems to be assigned to a local variable for no further use... I could build it after disabling the line but the resulting applet doesn't work - just shows white screen... – Ivan Aug 07 '11 at 15:49
  • @Ivan: It sounds like there are other things wrong then, to be honest. We can't tell what from the code you've given though, obviously. – Jon Skeet Aug 07 '11 at 15:50
  • Ok then. You've answered the question, I accept it, thanks. I will try to explore the code and contact the author to get it working... – Ivan Aug 07 '11 at 16:02