Saturday, June 16, 2007

User Interaction with Silverlight

Let's do a simple user interaction with silverlight.

I will take the example code from the previous post and add some extra attributes to the TextBlock Elements:


I have added the "x:Name" attribute, which will identify the textBlock in the code-behind file.

And also I have set the style of the cursor. I personally think that when there is some interaction with user, one should be reminded for that!

The next is simple MouseEventHandler in the code-behind file:


A simple "state" remembering variable and we are changing the text of the text block every time the user clicks on it.

No comments: