【问题标题】:zoom and scroll image in WP7 in image control area在图像控制区域中缩放和滚动 WP7 中的图像
【发布时间】:2012-12-01 15:41:08
【问题描述】:

有什么方法或资源可以完成以下任务吗? 我正在 xaml 中的 Image 控件中加载本地图像,想要启用放大/缩小但将缩放限制限制为 Image 控件的宽度和高度。

我在我的应用程序中使用了这种建议的方法Zoom and scroll image in wp7,但是图像缩放到图像控制区域之外并遮蔽了应用程序中的其他控件。

【问题讨论】:

    标签: c# windows-phone-7 xaml


    【解决方案1】:

    我不知道图像控件本身,但在我的可缩放画布(基于常规画布)中,我使用了剪辑属性。例如:

    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) };
            };
    
            }
    //...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-02
      • 2011-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多