0
現在,我想放大或縮小列表視圖上的圖片。這些問題的人有分享給我,但它使用Windows Phone 8.1不支持的ViewportControl。Windows Phone 8.1可以支持ViewportControl嗎?
現在,我想放大或縮小列表視圖上的圖片。這些問題的人有分享給我,但它使用Windows Phone 8.1不支持的ViewportControl。Windows Phone 8.1可以支持ViewportControl嗎?
Silverlight 8.1應用程序支持ViewportControl。 Windows Phone運行時應用程序不支持它。
您可以使用一個ScrollViewer中允許圖片進行放大或縮小:
<ScrollViewer x:Name="scrollViewer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
ZoomMode="Enabled" MinZoomFactor="0.7">
<Grid Height="200" Width="300">
<Image AutomationProperties.Name="Cute kitten picture" Source="Assets/gracie.jpg" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ScrollViewer>
或者你可以處理操縱事件直接縮放圖片。
<Image AutomationProperties.Name="Cute kitten picture" Source="Assets/gracie.jpg"
Stretch="Uniform"
ManipulationMode="Scale"
ManipulationDelta="Image_ManipulationDelta"
RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<CompositeTransform />
</Image.RenderTransform>
</Image>
C#
double minScale = 0.7;
private void Image_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
Image img = sender as Image;
CompositeTransform ct = img.RenderTransform as CompositeTransform;
ct.ScaleX *= e.Delta.Scale;
ct.ScaleY *= e.Delta.Scale;
if (ct.ScaleX < minScale) ct.ScaleX = minScale;
if (ct.ScaleY < minScale) ct.ScaleY = minScale;
}
見XAML scrolling, panning, and zooming sample證明了的ScrollViewer變焦。
有關操作操作的更多信息,請參閱Quickstart: Touch input。
嗨,我添加了一個問題。當放大但不移動和丟失項目列表視圖,只顯示1個文件圖像。 – Englbach 2014-10-06 05:27:35
嘿,滾動選擇時,縮放????? @Rob Caplan – Englbach 2014-10-12 04:28:29