Windows store apps 在ScrollViewer中具有拉伸垂直对齐的图像?
当我在容器(如HubSection)中有一个带有Windows store apps 在ScrollViewer中具有拉伸垂直对齐的图像?,windows-store-apps,winrt-xaml,Windows Store Apps,Winrt Xaml,当我在容器(如HubSection)中有一个带有VerticalAlignment=“Stretch”的图像时,该图像在我的页面中从上到下完全展开。即: <HubSection> <DataTemplate> <Image Loaded="BigPic_Loaded" ImageFailed="BigPic_ImageFailed" x:Name="BigPic" Source="htt
VerticalAlignment=“Stretch”
的图像时,该图像在我的页面中从上到下完全展开。即:
<HubSection>
<DataTemplate>
<Image
Loaded="BigPic_Loaded"
ImageFailed="BigPic_ImageFailed"
x:Name="BigPic"
Source="http://i.imgur.com/hd4tFk0.jpg"
VerticalAlignment="Stretch" />
</DataTemplate>
</HubSection>
这个问题有解决办法吗?解决办法是处理
ScrollViewer
的SizeChanged
事件,并将BigPic的大小设置为ScrollViewer
的大小
<HubSection>
<DataTemplate>
<ScrollViewer
ZoomMode="Enabled"
HorizontalScrollMode="Auto"
HorizontalScrollBarVisibility="Auto"
VerticalScrollMode="Auto"
VerticalScrollBarVisibility="Auto"
VerticalContentAlignment="Stretch"
MinZoomFactor="1"
MaxZoomFactor="4">
<Image
Loaded="BigPic_Loaded"
ImageFailed="BigPic_ImageFailed"
x:Name="BigPic"
Source="http://i.imgur.com/hd4tFk0.jpg"
VerticalAlignment="Stretch" />
</ScrollViewer>
</DataTemplate>
</HubSection>