C#/WPF: Any event that triggers when any changes a

2019-08-01 20:52发布

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.

GetImageFromClipboard = new RelayCommand(() => ImageData = Clipboard.GetImage(), () => Clipboard.ContainsImage() );

because it enables/disables my Button bound to that correctly. Can i do something like when the CanExecute changes, If theres an image, display it?

1条回答
登录 后发表回答