[英]C#/WPF: Any event that triggers when any changes are made to clipboard?
The final outcome I want is actually detect if the clipboard contains any Image, if so then set a Image control to display that image. 我想要的最终结果是实际上检测剪贴板是否包含任何图像,如果有,则设置一个图像控件以显示该图像。 I am thinking I will need a way to monitor the clipboard if it contains an Image.
我在想如果剪贴板包含图像,我将需要一种监控剪贴板的方法。 How can I achieve this?
我该如何实现? I am thinking probably theres no such event so maybe i check the clipboard at regular intervals to see if it contains any image if so display it?
我认为可能没有此类事件,所以也许我要定期检查剪贴板以查看是否包含任何图像(如果显示的话)? Will it be very inefficient?
效率会很低吗?
UPDATE 更新
I am wondering if the same mechanism that enables/disables my button when the clipboard contains an image can come into use here? 我想知道剪贴板中包含图像时启用/禁用我的按钮的机制是否可以在这里使用? I am using MVVM Foundation .
我正在使用MVVM Foundation 。
GetImageFromClipboard = new RelayCommand(() => ImageData = Clipboard.GetImage(), () => Clipboard.ContainsImage() );
because it enables/disables my Button bound to that correctly. 因为它可以正确启用/禁用绑定到我的Button。 Can i do something like when the CanExecute changes, If theres an image, display it?
我可以做类似CanExecute更改时的操作吗,如果有图像,则显示它?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.