填充浏览器窗口Silverlight应用程序 [英] Filling Browser Window with Silverlight Application

查看:117
本文介绍了填充浏览器窗口Silverlight应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的Silverlight应用程序,以填补整个浏览器窗口。我已经设置了插件对象的宽度和高度为100%,而我的LayoutRoot容器的高度和宽度设置为Auto,但仍没有运气。有什么建议?

I want my Silverlight app to fill the entire browser window. I've set the plugin object width and height to 100%, and set my LayoutRoot container's height and width to Auto, but still no luck. Any suggestions?

<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:Silverlight ID="Silverlight1" runat="server" 
    	Source="~/ClientBin/Client.xap"
    	MinimumVersion="2.0.30818.0"
    	AutoUpgrade="true"
    	Height="100%" 
    	Width="100%">
    </asp:Silverlight>
</form>

<UserControl 
    x:Class="Client.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Height="Auto"
    Width="Auto">
    <Grid 
    	x:Name="LayoutRoot" 
    	Background="#084E85"
    	ShowGridLines="True">
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="280" />
    		<ColumnDefinition Width="Auto" />
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="80" />
    		<RowDefinition Height="Auto" />
    		<RowDefinition Height="600" />
    	</Grid.RowDefinitions>

    	...Remaining content here...
    </Grid>
</UserControl>

声明:我寻找一个答案首先,找到的此线程。然而,正如你可以通过不适合我的工作我的code看到的。

Disclaimer: I searched for an answer first, finding this thread. However, as you can see by my code that isn't working for me.

推荐答案

首先,我不设置在用户控件的高度/宽度。相反,我设置了DesignHeight和DesignWidth(在http://schemas.microsoft.com/ex$p$pssion/blend/2008命名空间),我设置对齐伸展

First, I don't set the height/width in the user control. Instead, I set the DesignHeight and DesignWidth (in the "http://schemas.microsoft.com/expression/blend/2008" namespace) and I set the alignment to stretch

<UserControl ... 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
    d:DesignHeight="1050" d:DesignWidth="1680">

在我的HTML,我设置的高度和宽度为100%,这样的...

In my Html, I set the Height and Width to 100% like this...

<div style="height: 100%; width: 100%; position: fixed;">
        <asp:Silverlight runat="server" Source="~/ClientBin/My.xap" ID="MyId" 
            Width="100%" Height="100%" />
</div>

在这一点上,一切正常,我把它拿整个窗口。

At that point, everything works for me to have it take the entire window.

这篇关于填充浏览器窗口Silverlight应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆