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

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

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

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

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

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

 

posted @ 2011-09-15 19:11  焦涛  阅读(1801)  评论(0)    收藏  举报