首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UWP-XAML项控件-如何将具有最大高度/宽度的项的尺寸应用于项控件中的所有项

UWP-XAML项控件-如何将具有最大高度/宽度的项的尺寸应用于项控件中的所有项
EN

Stack Overflow用户
提问于 2017-06-08 15:23:05
回答 1查看 222关注 0票数 0

我正在使用来显示带有描述的项目。问题是,items控件中的所有项都使用第一个项的尺寸。我希望能够使用最大物品的尺寸。

当前输出:

所需输出:

这是代码。

代码语言:javascript
复制
<ItemsControl ItemsSource="{Binding PageContents.Items}" Style="{StaticResource ItemsControlAligmentStyle}" >
    <ItemsControl.ItemContainerTransitions>
        <TransitionCollection>
            <EntranceThemeTransition/>
        </TransitionCollection>
    </ItemsControl.ItemContainerTransitions>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <Grid BorderThickness="1" BorderBrush="Black" Margin="10">
                <StackPanel Width="300" Margin="10">
                    <TextBlock Text="{Binding Title}" Style="{StaticResource TitleblockStyleText}" />
                    <TextBlock Text="{Binding Description}" Style="{StaticResource DescriptionTextBlockStyle}" />
                </StackPanel>
            </Grid>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapGrid Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>

提前谢谢你!

EN

回答 1

Stack Overflow用户

发布于 2017-06-13 20:25:18

如果你愿意,你可以设置一个滚动查看器,允许在较大的框上滚动。您是否已经为第一个对象设置了尺寸,或者是StackPanel设置了宽度和高度?在某些情况下,字体可能太大,因此您可能必须缩小它或提高itemsControl的大小。你也可以选择滚动,就像我之前提到的那样。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44429202

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档