Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何正确设置Silverlight用户控件的高度?_Silverlight - Fatal编程技术网

如何正确设置Silverlight用户控件的高度?

如何正确设置Silverlight用户控件的高度?,silverlight,Silverlight,我无法让我的silverlight控件的高度超过600。请参阅下面的代码以重现此行为。请注意,色带在exaclty 600处停止。谁能告诉我如何让这个示例显示网格中的所有行 <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" r

我无法让我的silverlight控件的高度超过600。请参阅下面的代码以重现此行为。请注意,色带在exaclty 600处停止。谁能告诉我如何让这个示例显示网格中的所有行

<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/IT.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />
            </div>
    </form>
</body>
</html>

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

    </Grid>

我将网格的背景设置为Gray background=Gray,将所有行高度设置为50,以查看发生了什么。我认为您的UserControl比浏览器的视口高,但因为它是空的,所以不会显示滚动条。所以我在底部有一条灰色的带子,一直延伸到那页的底部


编辑:如果需要占用整个视口的UserControl,请从UserControl标记中删除宽度和高度

你的样品不完整。把整个XAML放出来,因为我认为阻止你的是XAML的顶端;要回答这个问题,文本框顶部有一个“代码”按钮。感谢您修复此富文本框。如何删除我的答案?我可以删除我的另一个重复问题吗?谢谢你的回答。从usercontrol标记中删除宽度和高度并不能达到目的。既然你把代码复制到你的机器上,你能让它工作吗?