3
<title>Stretch (VideoBrush) 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
<MediaElement x:Name="ExampleVideo" Source="../../media/video/timecode-short-wmv8.wmv" Opacity="0.0" IsHitTestVisible="False"/>
12
<Rectangle Canvas.Left="20" Canvas.Top="20" Stroke="Black" Width="100" Height="100" >
14
<VideoBrush SourceName="ExampleVideo" Stretch="None" />
17
<Rectangle Canvas.Left="120" Canvas.Top="20" Stroke="Black" Width="100" Height="100" >
19
<VideoBrush SourceName="ExampleVideo" Stretch="Fill" />
22
<Rectangle Canvas.Left="220" Canvas.Top="20" Stroke="Black" Width="100" Height="100" >
24
<VideoBrush SourceName="ExampleVideo" Stretch="Uniform" />
27
<Rectangle Canvas.Left="320" Canvas.Top="20" Stroke="Black" Width="100" Height="100" >
29
<VideoBrush SourceName="ExampleVideo" Stretch="UniformToFill" />
33
<Rectangle Canvas.Left="20" Canvas.Top="120" Stroke="Black" Width="100" Height="100" >
35
<VideoBrush x:Name="testcase1" SourceName="ExampleVideo" />
38
<Rectangle Canvas.Left="120" Canvas.Top="120" Stroke="Black" Width="100" Height="100" >
40
<VideoBrush x:Name="testcase2" SourceName="ExampleVideo" />
43
<Rectangle Canvas.Left="220" Canvas.Top="120" Stroke="Black" Width="100" Height="100" >
45
<VideoBrush x:Name="testcase3" SourceName="ExampleVideo" />
48
<Rectangle Canvas.Left="320" Canvas.Top="120" Stroke="Black" Width="100" Height="100" >
50
<VideoBrush x:Name="testcase4" SourceName="ExampleVideo" />
56
<script language="javascript">
57
function onLoaded (sender, args)
59
// invalid values defaults to *an empty image* (no value is FILL)
60
sender.findName ("testcase1").Stretch = -1;
61
sender.findName ("testcase2").Stretch = 911;
63
sender.findName ("testcase3").Stretch = "nOnE";
64
sender.findName ("testcase4").Stretch = "uNIFORMtOfILL";
66
// Silverlight shows an Alert
67
// Silverlight error message, ErrorCode: 2203, ErrorType:RuntimeError, Message: AG_E_RUNTIME_SETVALUE, MethodName: Stretch
69
sender.findName ("testcase3").Stretch = "";
76
<div id="SilverlightPluginHost" style="position:absolute; top:50px; left:50px; width:500px; height:50px;"></div>
78
<script type="text/javascript">
79
var pe = document.getElementById("SilverlightPluginHost");
80
Silverlight.createObject("#xaml", pe, "AgControl1", {
83
inplaceInstallPrompt:false,
94
<div style="position:absolute; top:400px; left:50px">
95
<p>0,0 should be the center of <b>0:0</b> (None)
96
<br>1,0 should be <b>+00:00:02:00</b> when video ends
97
<br>2,0 should be <b>+00:00:02:00</b> with white bands on top/bottom when video ends
98
<br>3,0 should be the center part of <b>0:00:02:0</b> when video ends
99
<p>0,1 should be <b>empty</b> (no video image, not even the rectangle border)
100
<br>1,1 should be <b>empty</b> (no video image, not even the rectangle border)
101
<br>2,1 should be the center of <b>0:0</b> (like 0,0)
102
<br>3,1 should be the center part of <b>0:00:02:0</b> when video ends (like 3,0)