3 <title>FontStyle (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">
9 <TextBlock Canvas.
Top=
"0" Canvas.
Left=
"0" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"No value" />
10 <TextBlock Canvas.
Top=
"0" Canvas.
Left=
"150" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" FontStyle=
"Normal" Text=
"Normal" />
11 <TextBlock Canvas.
Top=
"0" Canvas.
Left=
"300" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" FontStyle=
"Oblique" Text=
"Oblique" />
12 <TextBlock Canvas.
Top=
"0" Canvas.
Left=
"450" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" FontStyle=
"Italic" Text=
"Italic" />
14 <TextBlock x:
Name=
"testcase1" Canvas.
Top=
"100" Canvas.
Left=
"0" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase1" />
15 <TextBlock x:
Name=
"testcase2" Canvas.
Top=
"100" Canvas.
Left=
"150" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase2" />
16 <TextBlock x:
Name=
"testcase3" Canvas.
Top=
"100" Canvas.
Left=
"300" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase3" />
17 <TextBlock x:
Name=
"testcase4" Canvas.
Top=
"100" Canvas.
Left=
"450" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase4" />
19 <TextBlock x:
Name=
"testcase5" Canvas.
Top=
"200" Canvas.
Left=
"0" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase4" />
20 <TextBlock x:
Name=
"testcase6" Canvas.
Top=
"200" Canvas.
Left=
"150" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase5" />
21 <TextBlock x:
Name=
"testcase7" Canvas.
Top=
"200" Canvas.
Left=
"300" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase6" />
22 <TextBlock x:
Name=
"testcase8" Canvas.
Top=
"200" Canvas.
Left=
"450" Foreground=
"Black" FontFamily=
"Arial" FontSize=
"24" Text=
"testcase7" />
26 <script language=
"javascript">
27 function onLoaded (sender
, args
)
29 sender
.findName ("testcase1").FontStyle
= 0;
30 sender
.findName ("testcase2").FontStyle
= 1;
31 sender
.findName ("testcase3").FontStyle
= 2;
32 sender
.findName ("testcase4").FontStyle
= 3;
34 // invalid values defaults to None (no value is Default)
35 sender
.findName ("testcase5").FontStyle
= -1;
36 sender
.findName ("testcase6").FontStyle
= 911;
38 sender
.findName ("testcase7").FontStyle
= "oBlIqUe";
39 sender
.findName ("testcase8").FontStyle
= "iTaLiC";
41 // Silverlight shows an Alert
42 // Silverlight error message, ErrorCode: 2203, ErrorType:RuntimeError, Message: AG_E_RUNTIME_SETVALUE, MethodName: FontStyle
44 sender.findName ("testcase8").FontStyle = "gaga";
45 sender.findName ("testcase3").FontStyle = sender.findName ("testcase2");
46 sender.findName ("testcase3").FontStyle = null;
47 sender.findName ("testcase3").FontStyle = true;
54 <div id=
"SilverlightPluginHost" style=
"position:absolute; top:50px; left:50px; width:500px; height:50px;"></div>
56 <script type=
"text/javascript">
57 var pe
= document
.getElementById("SilverlightPluginHost");
58 Silverlight
.createObject("#xaml", pe
, "AgControl1", {
61 inplaceInstallPrompt
:false,
72 <div style=
"position:absolute; top:400px; left:50px">
73 <p>0,
0 "No value" text is
<b>normal
</b>
74 <br>1,
0 "Normal" text is
<b>normal
</b>
75 <br>2,
0 "Oblique" text is
<b>italic
</b>
76 <br>2,
0 "Italic" text is
<b>italic
</b>
77 <p>0,
1 "testcase1" text is
<b>normal
</b>
78 <br>1,
1 "testcase2" text is
<b>italic
</b>
79 <br>2,
1 "testcase3" text is
<b>italic
</b>
80 <br>3,
1 "testcase4" text is
<b>italic
</b>
81 <p>0,
2 "testcase5" text is
<b>italic
</b>
82 <br>1,
2 "testcase6" text is
<b>italic
</b>
83 <br>2,
2 "testcase7" text is
<b>italic
</b>
84 <br>3,
2 "testcase8" text is
<b>italic
</b>