Silverlight Grid-伸展到父母的容器大小,但不扩展以容纳儿童

| 有什么方法可以使silverlight / wpf网格拉伸到其父级宽度/高度(使用自动),但不能扩展以容纳子级吗?在Silverlight应用程序中,我具有以下内容: 主页,带有框架:
<ScrollViewer x:Name=\"LayoutRoot\" BorderThickness=\"0\" Padding=\"0\" ScrollViewer.HorizontalScrollBarVisibility=\"Auto\" ScrollViewer.VerticalScrollBarVisibility=\"Auto\">

    <Grid Background=\"White\">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height=\"Auto\"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Border Background=\"{StaticResource DefaultBackgroundBrush}\" BorderBrush=\"{StaticResource DefaultBorderBrush}\" BorderThickness=\"0,0,0,1\">
            <!--Some header content-->
        </Border>
        <sdk:Frame x:Name=\"Frame\" Grid.Row=\"1\" UriMapper=\"{StaticResource UriMapper}\" ContentLoader=\"{StaticResource ContentLoader}\" BorderThickness=\"0\" />
    </Grid>
</ScrollViewer>
在此框架中,我加载所需的页面:
<navigation:Page 
       xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" 
       xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" 
       xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"
       xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"
       xmlns:navigation=\"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation\" xmlns:sdk=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk\" x:Class=\"MyNamespace.MyPage\" mc:Ignorable=\"d\"
       d:DesignWidth=\"640\" d:DesignHeight=\"480\"
        Title=\"{StaticResource PageTitle}\">
<Grid x:Name=\"LayoutRoot\">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height=\"Auto\"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <StackPanel d:LayoutOverrides=\"Width\" Visibility=\"Collapsed\">
            <!-- Some header content -->
        </StackPanel>
        <Grid Grid.Row=\"1\">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height=\"Auto\"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <TextBlock TextWrapping=\"Wrap\" Text=\"Titletext\" FontSize=\"13.333\" FontWeight=\"Bold\" d:LayoutOverrides=\"Height\"/>
            <RichTextBox BorderThickness=\"0\" IsReadOnly=\"True\" Background=\"{x:Null}\" BorderBrush=\"{x:Null}\" VerticalScrollBarVisibility=\"Auto\" Grid.Row=\"1\" Padding=\"0\">
                <Paragraph><Run Text=\"Text that will force the grid to expand.\"/></Paragraph>
            </RichTextBox>
        </Grid>
    </Grid>
</Grid></navigation:Page>
主页中的框架旨在处理其内容溢出(通过滚动查看器),因为我有一些页面需要最小尺寸。 容纳文本框的网格延伸到父级,但是当我在文本框中放入大文本时,网格将调整为文本的宽度,从而使框架的滚动查看器的水平滚动条出现。我正在寻找一种不需要将网格的最大大小绑定到其父对象的最大大小的解决方案(无论如何,如果没有在Silverlight中进行破解,因为绑定到ActualWidth / Height会出错,这是行不通的) 。有任何想法吗?     
已邀请:
        您只需要像已经发布的那样更改包装,并更改ScrollViewer的一个属性即可:
ScrollViewer.HorizontalScrollBarVisibility=\"Auto\"
ScrollViewer.HorizontalScrollBarVisibility=\"Disabled\"
    

要回复问题请先登录注册