Silverlight raised events not reaching javascript/HTML page

One of the events in my Silverlight app did not appear to reach my HTML page. Turned out that I had lazily put an event handler in my Silverlight app as follows:

      void buttonClose_Click(object sender, EventArgs e)
        {
            if (Close != null)
            {
                Close(this, e);
            }
        }

The problem being the event args that came through from the buttonClose event could not be passed to javascript. No errors were thrown to help me, but all was fine again by changing the code to:

     void buttonClose_Click(object sender, EventArgs e)
        {
            if (Close != null)
            {
                Close(this, new EventArgs());             }
        }

Note that even Close(this, null) seemed to stop the event getting through.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s