I have the following Silverlight code:
[ScriptableType]
public partial class Page : UserControl
{
[ScriptableMember]
public event EventHandler<UploadChangedEventArgs> OnFileProgressChanged;
private void FileProgressChanged_Click(object sender,RoutedEventArgs e)
{ // test reasons only
OnFileProgressChanged(null, new UploadChangedEventArgs()
{
Id = Guid.NewGuid(),
Sent = 12345,
Started = DateTime.Now
});
}
}
The event arguments have this structure:
[ScriptableType]
public class UploadChangedEventArgs : EventArgs
{
public Guid Id { get; set; }
public long Sent { get; set; }
public DateTime Started { get; set; }
}
On Javascript side, I wrote the event callback (and it gets fired):
function onFileUploadProgressChanged(sender, e) {
alert(JSON.stringify(e)); // shows "{}"
alert(e.Sent); // shows "12345"
}
I need to stringify that data to send it through a postback event. What's wrong?