Vivek Saurav
Vivek Saurav

Reputation: 2275

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 .

Upvotes: 1

Views: 275

Answers (1)

Sriram Sakthivel
Sriram Sakthivel

Reputation: 73502

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
}

If you're not familiar with static members you can read it here

Upvotes: 5

Related Questions