【问题标题】:Silverlight Control won't go higher than 600, bug?Silverlight Control 不会超过 600,错误?
【发布时间】:2009-01-06 22:42:21
【问题描述】:

试试这个示例代码。下面是带有 silverlight 控件的 aspx 页面,下面是带有彩色行的网格的 xaml 代码。请注意,网格有 8 行,每行高度为 100,但仅显示前 6 行。我无法控制显示大于 600 的值。


aspx 代码


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div>
        <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/x.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />
        </div>
</form>
</body>
</html>

XAML 代码


<UserControl xmlns:my1="clr- namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="x.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
Width="400" Height="Auto">
<Grid x:Name="LayoutRoot" Background="White">
    <Grid.RowDefinitions >
        <RowDefinition Height="100"/>
        <RowDefinition  Height="100"/>
        <RowDefinition  Height="100"/>
        <RowDefinition  Height="100"/>
        <RowDefinition  Height="100"/>
        <RowDefinition Height="100" />
        <RowDefinition Height="100" />
        <RowDefinition Height="100" />
    </Grid.RowDefinitions>

    <Rectangle Grid.Row="0" Fill="Green"/>
    <Rectangle Grid.Row="1" Fill="Red" />
    <Rectangle Grid.Row="2" Fill="Blue" />
    <Rectangle Grid.Row="3" Fill="Orange"/>
    <Rectangle Grid.Row="4" Fill="Yellow" />
    <Rectangle Grid.Row="5" Fill="Black" />
    <Rectangle Grid.Row="6" Fill="Aqua"/>
    <Rectangle Grid.Row="7" Fill="Olive"/>

</Grid>
</UserControl>

想法?

【问题讨论】:

  • 你已经在另一个帖子中问过这个问题。不要。
  • 我知道这一点。当我第一次发布它时,它只显示了部分代码,因为(我认为)我没有正确格式化它以显示所有代码。所以我用正确的格式再次发布了它。如何删除此帖子?

标签: silverlight


【解决方案1】:

我刚刚尝试了您的 XAML 和 ASPX,它对我有用;我可以看到所有三行。在创建一个新的 Silverlight 项目时,VS 添加了这个 ASPX -

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
        TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" style="height:100%;">
    <head runat="server">
        <title>SilverlightApplication1</title>
    </head>
    <body style="height:100%;margin:0;">
        <form id="form1" runat="server" style="height:100%;">
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <div  style="height:100%;">
                <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/SilverlightApplication1.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />
            </div>
        </form>
    </body>
    </html>

你可以试试上面的 ASPX 吗?

HTH, 印地

【讨论】:

  • Indy,感谢您的回复,但您应该看到 8 行,而不是 3 行。这就是我的观点,控件在 600 高度处切断。
  • 这是我开始使用的aspx,它也不起作用。你试过了吗?你看到 8 行了吗?
猜你喜欢
  • 2020-11-23
  • 1970-01-01
  • 1970-01-01
  • 2019-02-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多