【发布时间】:2017-11-16 09:40:37
【问题描述】:
我试图在滚动查看器中固定左标题,但它的高度不等于 itemspresenter。我已经给了代码sn-p。
<ItemsControl>
<ItemsControl.Template>
<ControlTemplate>
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.HorizontalScrollMode="Enabled"
HorizontalSnapPointsType="Mandatory">
<ScrollViewer.LeftHeader>
<Grid Width="190" Height="1000" Background="Black"/>
</ScrollViewer.LeftHeader>
<ItemsPresenter HorizontalAlignment="Left"
VerticalAlignment="Top"/>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Horizontal" ItemsUpdatingScrollMode="KeepItemsInView">
</ItemsStackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Items>
<Grid Width="1536" Height="1000" Background="Yellow"/>
<Grid Width="1536" Height="1000" Background="Red"/>
<Grid Width="1536" Height="1000" Background="Black"/>
</ItemsControl.Items>
</ItemsControl>
您需要向上滚动才能看到gap。
【问题讨论】:
-
它们看起来都与您的代码具有相同的高度,专门将它们全部设置为
1000。 -
预计高度相同,但看起来并不相同。左侧标头占用屏幕高度。但我已经明确给出了 1000 个。
-
是的。我看到它们都具有相同的高度。从您的代码中直接复制。
-
对不起,贾斯汀,它没有按预期工作。不知道是什么问题。共享代码是我也在研究的内容。但左侧标题“黑色网格”的高度似乎比项目控件中的其他网格短。请向下滚动并查看高度差异@JustinXL
-
哦...所以您需要滚动才能看到...我的错。对我来说似乎是一个错误。
标签: xaml uwp winrt-xaml uwp-xaml