Silverlight Events
Just a short post about Silverlight events.
When writing Silverlight apps using Orcas and Silverlight 1.1, there are 2 key ways that you can hook up events.
The first way is to specify the event directly in the Xaml:
<canvas mouseleftbuttonup="ClickMeButton_MouseLeftButtonUp" background="Red" height="30" width="100" name="ClickMeButton">
The second way (as demonstrated in the ScottGu video on the Silverlight.net site) is to do it in code:
ClickMeButton.MouseEnter += new MouseEventHandler(ClickMeButton_MouseLeftButtonUp);
In both cases there would be a resultant method to deal with the event like in all event driven applications.
I think most people are aware of the latter approach because of the video but the former approach also lets you keep your code behind a bit more tidy.
ende
When writing Silverlight apps using Orcas and Silverlight 1.1, there are 2 key ways that you can hook up events.
The first way is to specify the event directly in the Xaml:
<canvas mouseleftbuttonup="ClickMeButton_MouseLeftButtonUp" background="Red" height="30" width="100" name="ClickMeButton">
The second way (as demonstrated in the ScottGu video on the Silverlight.net site) is to do it in code:
ClickMeButton.MouseEnter += new MouseEventHandler(ClickMeButton_MouseLeftButtonUp);
In both cases there would be a resultant method to deal with the event like in all event driven applications.
I think most people are aware of the latter approach because of the video but the former approach also lets you keep your code behind a bit more tidy.
ende
Labels: Orcas, Silverlight, Xaml