How to perform Event handling in silver light?.

 Posted by Naveen86 on 8/16/2009 | Category: Silverlight Interview questions | Views: 6033

Silverlight 1.0 uses JavaScript, while Silverlight 2.0 uses C# (managed code) for event handling. We will be describing the event model for Silverlight 2.0.

The event handlers are defined in the code-behind file that backs the XAML definition of your User Interface (UI), namely mypage.xaml.cs.

The Silverlight Event Mode

In Silverlight, there are two event cases:

Input events
Non-input events.

Input Events: The browser that hosts the Silverlight plug-in handles initial input stimulus for the input events. This is because Silverlight works within the plug-in architecture of the hosting browser. From the browser, the event is sent to the Silverlight plug-in.

Then, it is raised as an event in the Silverlight Object Model.

Non-input Events: They report a state change to a particular object, for example, the state change events that report asynchronous download state or progress of actions initiated by Web Client. Some non-input events provide lifetime information of objects at a framework level.

For example the FrameworkElement.Loaded event

Some events, such as OnError, can only be handled by the Silverlight plug-in instance and exist within the HTML Document Object Model (DOM). These events need to be continually exposed and possibly handled by any script working with the plug-in instance in the DOM. Therefore; these events are not passed to the managed programming model.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response

More Interview Questions by Naveen86