简体   繁体   English

如何通过单击删除装饰物?

[英]How can I remove an adorner by clicking it?

My adorner is drawn in code using the drawingContext in OnRender. 我的装饰器是使用OnRender中的drawingContext在代码中绘制的。 I want the user to be able to click the adorner, or a button on it, to close it. 我希望用户能够单击装饰器或装饰器上的按钮将其关闭。 What would I do in the adorner's MouseButtonEventHandler to do this? 我将在装饰器的MouseButtonEventHandler中做什么呢?

I imagine I need to remove it from the adorner layer of the adorned control, but I can't see how I trigger that from the adorner itself. 我想我需要从装饰控件的装饰层中将其删除,但是我看不到如何从装饰本身触发它。

Thanks in advance for any pointers. 在此先感谢您提供任何指导。

找到了更好的解决方案-允许用户将装饰器(在这种情况下为便签)拖到不妨碍的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM