我有一个全屏幕的图片,使用以下代码实现:
<phone:PhoneApplicationPage
x:Class="solution.FullScreenViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<Image Name="img" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"Stretch="Uniform"/>
</phone:PhoneApplicationPage>
这只是一个更大项目的一部分。我想实现在单击图像后全屏打开图像的功能,因此我制作了另一个页面,只有一个图像,没有其他内容。我正在使用以下代码从C#加载图像:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
string context = this.NavigationContext.QueryString["context"];
img.Source = new BitmapImage(new Uri(context, UriKind.RelativeOrAbsolute));
base.OnNavigatedTo(e);
}
现在我想要添加一个图片缩放选项,但是我不知道该怎么做。我尝试了谷歌搜索,但是我唯一找到的方法是在ScroolViewer中使用ZoomMode,但是这对我不起作用(它说成员ZoomMode未被识别)。是否有其他缩放方案?