Silverlight/XAML – Learning by Coding
1: <?xml version="1.0" encoding="UTF-8"?>
2: <!-- coded by Thomas Meinike 02/08 -->
3: <Canvas xmlns="http://schemas.microsoft.com/client/2007"
4: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
5:
6: <TextBlock Canvas.Top="30" Canvas.Left="30" FontFamily="Arial" FontSize="16"
7: Foreground="#00C" Text="Silverlight.net" Tag="http://silverlight.net/"
8: MouseEnter="TextOver" MouseLeave="TextOut" MouseLeftButtonDown="HyperLink"/>
9:
10: <TextBlock Canvas.Top="30" Canvas.Left="150" FontFamily="Arial" FontSize="16"
11: Foreground="#00C" Text="Datenverdrahten.de" Tag="http://datenverdrahten.de/"
12: MouseEnter="TextOver" MouseLeave="TextOut" MouseLeftButtonDown="HyperLink"/>
13:
14:
15: <!-- // zusätzlich verwendeter JavaScript-Code:
16:
17: function HyperLink(sender,eventArgs)
18: {
19: var url=sender.tag;
20:
21: if(url!="")window.location.href=url;
22: }
23:
24:
25: function TextOver(sender,eventArgs)
26: {
27: var txt_obj=sender;
28:
29: txt_obj.cursor="Hand";
30: txt_obj.foreGround="#F00";
31: txt_obj.textDecorations="Underline";
32: }
33:
34:
35: function TextOut(sender,eventArgs)
36: {
37: var txt_obj=sender;
38:
39: txt_obj.cursor="Default";
40: txt_obj.foreGround="#00C";
41: txt_obj.textDecorations="None";
42: }
43:
44: -->
45:
46: </Canvas>
[zum Anfang]