Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 具有rotatetransform breaks布局的图像上的上下文菜单_Windows Phone - Fatal编程技术网

Windows phone 具有rotatetransform breaks布局的图像上的上下文菜单

Windows phone 具有rotatetransform breaks布局的图像上的上下文菜单,windows-phone,Windows Phone,我想将关联菜单附加到旋转(例如90度)的图像。 它可以工作,但当上下文菜单出现时,图像会向右移动。有时它几乎完全脱离屏幕,有时则不然,这取决于它的“原始位置”。 问题是: 这就是没有关联菜单时的外观: 图像当然是缩放的。 以下是生成此信息的相关代码: Canvas _can = new Canvas(); _can.Width = 480; _can.Height = 260; Image _resImg = new Image(); BitmapImage bimp = new Bitma

我想将关联菜单附加到旋转(例如90度)的图像。 它可以工作,但当上下文菜单出现时,图像会向右移动。有时它几乎完全脱离屏幕,有时则不然,这取决于它的“原始位置”。 问题是:

这就是没有关联菜单时的外观:

图像当然是缩放的。 以下是生成此信息的相关代码:

Canvas _can = new Canvas();
_can.Width = 480;
_can.Height = 260;
Image _resImg = new Image();
BitmapImage bimp = new BitmapImage();
properOrient = 1;
bimp = GetImageFromIsolatedStorage("new" + step.ToString() + ".jpg");
_resImg.Source = bimp;
_resImg.Height = 260;
_resImg.Width = 260;
_resImg.Stretch = Stretch.UniformToFill;
RotateTransform _rT = new RotateTransform();
_rT.Angle = 0;
if (properOrient == 6)
   _rT.Angle = 90;
if (properOrient == 3)
   _rT.Angle = 180;
_rT.CenterX = 130;
_rT.CenterY = 130;
_resImg.RenderTransform = _rT;
_resImg.Margin = new Thickness(0, 0, 0, 0);
ContextMenu _cms = new ContextMenu();
MenuItem _mitm = new MenuItem() {
   Header = AppResources.ResourceManager.GetString("ApplicationBarDelete", AppResources.Culture),
   Tag = "delete"
};
_cms.Items.Add(_mitm);
ContextMenuService.SetContextMenu(_resImg, _cms);
_can.Children.Add(_resImg);
你知道这是什么原因吗? 如果旋转角度设置为0,则问题仍然存在。 如果未应用rotateTransform,则一切正常。 该设备为HTC 8s,尽可能更新。

问题在于关联菜单的“缩小”功能。 它似乎只是删除了一些基本上应用于任何元素的转换。除了在XAML或代码中使用IsZoomEnabled=false禁用缩放功能外,我还没有找到任何其他解决方法

我希望它能帮助别人