带有内容控件的自动行定义网格

发布于 2024-09-03 20:47:36 字数 684 浏览 4 评论 0原文

我有一个页面,其中有两个由 RegionManager 加载的 ContentControl。项目列表以及这些项目的详细视图。问题是网格没有应用我喜欢的自动高度。所以我想让所有可用的屏幕尺寸为grid.row=0。我在下面添加了我的代码:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition MinHeight="300" Height="Auto" />
        <RowDefinition Height="200"/>
    </Grid.RowDefinitions>

    <ContentControl Grid.Row="0" x:Name="ListRegion" ListMededelingRegion}" IsTabStop="False" Focusable="False" Height="Auto" />
    <ContentControl VerticalAlignment="Bottom" Grid.Row="1" x:Name="DetailRegion" cal:RegionManager.RegionName="{x:Static com:RegionNames.DetailRegion}" IsTabStop="False" Focusable="False" />
</Grid>

I have a Page with two ContentControls loaded by a RegionManager. A List of items, and a DetailView of these items. The problem is that the grid doesn't apply the auto height what I liked to. So I want to make all the available screen size to grid.row=0. I've added my code below:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition MinHeight="300" Height="Auto" />
        <RowDefinition Height="200"/>
    </Grid.RowDefinitions>

    <ContentControl Grid.Row="0" x:Name="ListRegion" ListMededelingRegion}" IsTabStop="False" Focusable="False" Height="Auto" />
    <ContentControl VerticalAlignment="Bottom" Grid.Row="1" x:Name="DetailRegion" cal:RegionManager.RegionName="{x:Static com:RegionNames.DetailRegion}" IsTabStop="False" Focusable="False" />
</Grid>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

も让我眼熟你 2024-09-10 20:47:36

Auto 表示“根据内容调整大小”;您需要指定 * 才能使用所有可用高度:

<Grid.RowDefinitions>
    <RowDefinition MinHeight="300" Height="*" />
    <RowDefinition Height="200"/>
</Grid.RowDefinitions>

Auto means "size to content" ; you need to specify * to use all available height :

<Grid.RowDefinitions>
    <RowDefinition MinHeight="300" Height="*" />
    <RowDefinition Height="200"/>
</Grid.RowDefinitions>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文