Advertise with us

Buttons not accessible in Wpf Codebehind

There is a function in Codebehind c# The Code is Like :

private static void ReceiveCallback(IAsyncResult ar)
   // ...

In this Function i have to set the visibility of a button to true :

Runrc.IsEnabled = true;

But I get no intellisense for this button in that function, and it's giving me a error.

Last updated:1/27/2014 3:23:33 AM

1 Answers

Pravesh Singh
Pravesh Singh

Hi Jacob,

That is because the method is static. You cannot access a instance member in static method without its object reference.

private void ReceiveCallback(IAsyncResult ar)//Remove static
   // access your button here