【发布时间】:2012-12-01 15:41:08
【问题描述】:
有什么方法或资源可以完成以下任务吗? 我正在 xaml 中的 Image 控件中加载本地图像,想要启用放大/缩小但将缩放限制限制为 Image 控件的宽度和高度。
我在我的应用程序中使用了这种建议的方法Zoom and scroll image in wp7,但是图像缩放到图像控制区域之外并遮蔽了应用程序中的其他控件。
【问题讨论】:
标签: c# windows-phone-7 xaml
有什么方法或资源可以完成以下任务吗? 我正在 xaml 中的 Image 控件中加载本地图像,想要启用放大/缩小但将缩放限制限制为 Image 控件的宽度和高度。
我在我的应用程序中使用了这种建议的方法Zoom and scroll image in wp7,但是图像缩放到图像控制区域之外并遮蔽了应用程序中的其他控件。
【问题讨论】:
标签: c# windows-phone-7 xaml
我不知道图像控件本身,但在我的可缩放画布(基于常规画布)中,我使用了剪辑属性。例如:
public partial class ZUICanvas : UserControl
{
public ZUICanvas()
{
InitializeComponent();
FrameworkElement viewport;
#if(!LITE)
viewport = this;
#else
viewport = Viewport; //just another implementation
#endif
viewport.SizeChanged += (sender, e) =>
{
viewport.Clip = new RectangleGeometry { Rect = new Rect(0, 0, viewport.ActualWidth, viewport.ActualHeight) };
};
}
//...
【讨论】: