3
<title>TextDecorations (TextBlock) Test Page</title>
5
<script language="javascript" src="Silverlight.js"></script>
7
<script type="text/xaml" id="xaml">
8
<Canvas x:Name="canvas" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="100" Height="100" Loaded="onLoaded">
10
<TextBlock Canvas.Top="0" Canvas.Left="0" Foreground="Black" FontFamily="Arial" FontSize="24" Text="No value" />
11
<TextBlock Canvas.Top="0" Canvas.Left="150" Foreground="Black" FontFamily="Arial" FontSize="24" TextDecorations="None" Text="None" />
12
<TextBlock Canvas.Top="0" Canvas.Left="300" Foreground="Black" FontFamily="Arial" FontSize="24" TextDecorations="Underline" Text="Underline" />
14
<TextBlock x:Name="testcase1" Canvas.Top="50" Canvas.Left="0" Foreground="Black" FontFamily="Arial" FontSize="24" Text="testcase1 " />
15
<TextBlock x:Name="testcase2" Canvas.Top="50" Canvas.Left="150" Foreground="Black" FontFamily="Arial" FontSize="24" Text=" testcase2 " />
16
<TextBlock x:Name="testcase3" Canvas.Top="50" Canvas.Left="300" Foreground="Black" FontFamily="Arial" FontSize="24" Text=" testcase3" />
18
<TextBlock x:Name="testcase4" Canvas.Top="100" Canvas.Left="0" Foreground="Black" FontFamily="Arial" FontSize="24" Text="testcase4 " />
19
<TextBlock x:Name="testcase5" Canvas.Top="100" Canvas.Left="150" Foreground="Black" FontFamily="Arial" FontSize="24" Text=" testcase5 " />
20
<TextBlock x:Name="testcase6" Canvas.Top="100" Canvas.Left="300" Foreground="Black" FontFamily="Arial" FontSize="24" Text=" testcase6" />
22
<TextBlock x:Name="testcase7" Canvas.Top="150" Canvas.Left="0" Foreground="Black" FontFamily="Arial" FontSize="24" Text="-5" />
23
<TextBlock x:Name="testcase8" Canvas.Top="150" Canvas.Left="30" Foreground="Black" FontFamily="Arial" FontSize="24" Text="-4" />
24
<TextBlock x:Name="testcase9" Canvas.Top="150" Canvas.Left="60" Foreground="Black" FontFamily="Arial" FontSize="24" Text="-3" />
25
<TextBlock x:Name="testcase10" Canvas.Top="150" Canvas.Left="90" Foreground="Black" FontFamily="Arial" FontSize="24" Text="-2" />
26
<TextBlock x:Name="testcase11" Canvas.Top="150" Canvas.Left="120" Foreground="Black" FontFamily="Arial" FontSize="24" Text="-1" />
27
<TextBlock x:Name="testcase12" Canvas.Top="150" Canvas.Left="150" Foreground="Black" FontFamily="Arial" FontSize="24" Text="0" />
28
<TextBlock x:Name="testcase13" Canvas.Top="150" Canvas.Left="180" Foreground="Black" FontFamily="Arial" FontSize="24" Text="1" />
29
<TextBlock x:Name="testcase14" Canvas.Top="150" Canvas.Left="210" Foreground="Black" FontFamily="Arial" FontSize="24" Text="2" />
30
<TextBlock x:Name="testcase15" Canvas.Top="150" Canvas.Left="240" Foreground="Black" FontFamily="Arial" FontSize="24" Text="3" />
31
<TextBlock x:Name="testcase16" Canvas.Top="150" Canvas.Left="270" Foreground="Black" FontFamily="Arial" FontSize="24" Text="4" />
32
<TextBlock x:Name="testcase17" Canvas.Top="150" Canvas.Left="300" Foreground="Black" FontFamily="Arial" FontSize="24" Text="5" />
36
<script language="javascript">
37
function onLoaded (sender, args)
39
sender.findName ("testcase1").TextDecorations = -1001;
40
sender.findName ("testcase2").TextDecorations = 0;
41
sender.findName ("testcase3").TextDecorations = 1;
42
sender.findName ("testcase4").TextDecorations = 1000;
44
sender.findName ("testcase5").TextDecorations = "nOnE";
45
sender.findName ("testcase6").TextDecorations = "uNdErLiNe";
47
sender.findName ("testcase7").TextDecorations = -5;
48
sender.findName ("testcase8").TextDecorations = -4;
49
sender.findName ("testcase9").TextDecorations = -3;
50
sender.findName ("testcase10").TextDecorations = -2;
51
sender.findName ("testcase11").TextDecorations = -1;
52
sender.findName ("testcase12").TextDecorations = 0;
53
sender.findName ("testcase13").TextDecorations = 1;
54
sender.findName ("testcase14").TextDecorations = 2;
55
sender.findName ("testcase15").TextDecorations = 3;
56
sender.findName ("testcase16").TextDecorations = 4;
57
sender.findName ("testcase17").TextDecorations = 5;
59
// Silverlight shows an Alert
60
// Silverlight error message, ErrorCode: 2203, ErrorType:RuntimeError, Message: AG_E_RUNTIME_SETVALUE, MethodName: TextDecorations
62
sender.findName ("testcase3").TextDecorations = sender.findName ("testcase2");
63
sender.findName ("testcase3").TextDecorations = null;
64
sender.findName ("testcase3").TextDecorations = true;
71
<div id="SilverlightPluginHost" style="position:absolute; top:50px; left:50px; width:500px; height:50px;"></div>
73
<script type="text/javascript">
74
var pe = document.getElementById("SilverlightPluginHost");
75
Silverlight.createObject("#xaml", pe, "AgControl1", {
78
inplaceInstallPrompt:false,
89
<div style="position:absolute; top:400px; left:50px">
90
<p>Line 1: Only underline is underlined.
91
<p>Line 2: testcase1 and testcase3 are underlined
92
<p>Line 3: Only testcase6 is underlined.
93
<p>Line 4: Odd numbers are underlined, Even numbers are not.