忘れやすいのでメモ。
Page.xaml
Silverlight アプリケーションのメイン画面の XAML。
<UserControl x:Class="FullScreenSample.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid x:Name="LayoutRoot" Background="Black"> </Grid> </UserControl>
Width と Height の記述を XAML から削除。
Silverlight アプリケーションのホスト
asp の場合
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/FullScreenSample.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />
Silverlight サーバーコントロールの Width と Height の値に 100% を指定する。
html の場合
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> <param name="source" value="ClientBin/FullScreenSample.xap"/> <param name="onerror" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="2.0.31005.0" /> <param name="autoUpgrade" value="true" /> <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Microsoft Silverlight を取得" style="border-style: none"/> </a> </object>
object の width 属性と height 属性の値に 100% を指定する。
100% を 50% に変更すれば、ブラウザの画面に対して半分の高さと幅で表示される。