Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
730
Enabling Paste option on the basis of copied nodes
posted

Hi,

I have a copy and a paste button on my UI. I want to enable Paste button when there are some copied nodes on the clipboard. I know one workaround is to set a bool when calling CopySelectedNodes()  for e.g.

bool hasCopiedNodes = ultraTree1.CopySelectedNodes();

if(hasCopiedNodes)

btnPaste.Enabled = true;

if i have Enabled the paste button, what if somehow the clipboard get cleared or the copied data is no longer available, How can i know that the Copied data is no longer available on the basis of which i will disable my Paste button.

  • 69832
    Offline posted

    It would seem that the Clipboard class does not expose any events that fire when the contents change, so the only solution I can think of would be to call the GetData method on a timer to see if what it contains, and then enable/disable the button accordingly.