在Silverlight中,我们可以使用InlineUIContainer将图像插入到RichTextBox中。 现在我试图添加一些处理程序到这个图像。这里是我的代码:将处理程序添加到Silverlight中RichTextBox中的图像
InlineUIContainer contain = new InlineUIContainer();
Image image = new Image();
ImageSource img = new BitmapImage(new Uri(Source,UriKind.RelativeOrAbsolute));
image.SetValue(Image.SourceProperty, img);
image.MouseEnter +=new MouseEventHandler(image_MouseEnter);
container.Child = image;
rtb.Selection.Insert(contain);
但是,当我们移动鼠标进入这个图像,什么都没有发生。 我想添加的是一些处理程序,如调整大小,单击和拖放。可能吗? 我很欣赏任何答案。谢谢!
它已经是半个月了...欢迎任何评论... – Mrainy 2011-03-27 18:33:35
我目前正在研究类似问题。这*可能会在这里发生。在版本注释中,[MSDN for UIElement.MouseWheel](http://msdn.microsoft.com/en-us/library/system.windows.uielement.mousewheel(v = VS.95).aspx),它声明“Silverlight 4具有对MouseWheel进行特定控制处理的控件,这意味着在某些情况下,您的用户代码事件处理程序不会被调用,因为控件会将事件标记为已处理。您仍然可以处理这些情况,但是您必须特别使用AddHandler并把事件处理为真。“祝你好运。 – seekerOfKnowledge 2011-04-20 20:22:45