本来想再Image上做将图片拖动到Image控件上时,显示图片,但是设置AllowDrop任然无效。只能用Grid等控件作为容器,并设置其父容器为AllowDrop=true.

而且不能在xaml中利用Image的方式,因为拖动图片为项目的外部文件,在获取图片的FullName会报如下的错误

   <Image  Source="{Binding ImageUri}" Width="200" Height="200"/> 

在Image控件中设置AllowDrop=true无效

只能用替代的方式,这种方式就是要知道Image的Name,对于MVVM方式不利

 BitmapImage image = new BitmapImage();                       
image.SetSource(fs);
image1.Source
= image;

 

相关文章:

  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案