0
我使用下面給出的代碼在畫布上顯示圖像,現在我想要在該圖像上長按刪除顯示的圖像。我嘗試了contextmenu,但它不起作用。請任何人告訴我,我怎麼能做到這一點或正確使用文本菜單它我想在畫布上的圖像上刪除longpress上的圖像
private void Stickers1_SelectionChanged(object sender, SelectionChangedEventArgs e) {
var selecteditem = e.AddedItems[0] as StickersImageListModel;
Stickers1.Visibility = Visibility.Collapsed;
// taking image from a list StickersImageListModel of images and bind with imageitem varaible
Image imageitem = new Image();
BitmapImage image = new BitmapImage(new System.Uri(selecteditem.Imageurl, UriKind.Absolute));
imageitem.Source = image;
//Add the images on canvas
my_canvas.Children.Add(imageitem);
imageitem.AllowDrop = true;
// DRag and drop the images on canvas
imageitem.ManipulationMode = ManipulationModes.All;
imageitem.ManipulationDelta += Drag_ManipulationDelta;
CompositeTransform ct = new CompositeTransform();
imageitem.RenderTransform = ct;
my_canvas.Visibility = Visibility.Visible;
}
*「它不工作」 *是不是一個錯誤的描述。 – IInspectable
它適用於我的應用程序 –
這段代碼沒有錯誤,但我想刪除longpress圖像上的圖像 –