windows-store-apps - HubSection 中的 DataTemplate 没有得到全高

标签 windows-store-apps winrt-xaml windows-8.1

我有以下代码:

<HubSection x:Name="modules_section" ...>
    <DataTemplate>
        <StackPanel Orientation="Vertical">
        ..................................

如何让 StackPanel 占据 HubSection 的全部高度?

VerticalAlignment="Stretch"不起作用。

我也尝试使用绑定(bind)通过

<StackPanel Height={Binding ElementName=modules_section, Path=ActualHeight}" ...>

但集线器部分的实际高度似乎为 0(我也尝试在代码隐藏中设置它并调试以查看值)。

最佳答案

一个 <StackPanel>与其中的内容一样大,但一般来说,使 <HubSection> 中的项目与节中的剩余空间一样高,就像设置 VerticalContentAlignment 一样简单在该部分上,即:

<HubSection VerticalContentAlignment="Stretch">
    <DataTemplate>
        <ScrollViewer HorizontalScrollMode="..." VerticalScrollMode="...">
            <StackPanel Orientation="Vertical">
                ...

在这种情况下,我将包装我的 <StackPanel><ScrollViewer>应对有足够数据需要滚动的情况

关于windows-store-apps - HubSection 中的 DataTemplate 没有得到全高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22907672/

相关文章:

c# - 如何将文本 block 可见性绑定(bind)到另一个文本 block 文本属性

c# - 无法在 Win8.1 C# 应用程序中将应用程序锁定为横向

unit-testing - Windows 应用商店应用程序单元测试 USB 设备

visual-studio-2012 - WinJS 智能感知无法正常工作

xaml - 拉伸(stretch)的 Windows 应用商店 Logo

c# - 如何使用 XAML 和 C# 根据其当前位置选择垂直 ListView 项目?

c# - 从MVVM中的ListView调用命令

visual-c++ - Qt Creator 2.8.1 + MSVC 2013 Express = 没有编译器可以为此 Qt 版本生成代码

javascript - 在 Javascript Windows 应用商店应用程序中加载许多音频文件

c# - ObservableCollection 中索引在范围内的不合逻辑 ArgumentOutOfRangeException