Buttons not accessible in Wpf Codebehind

Total Post:88

Points:616
C# 
C#
 2096  View(s)
Ratings:
Rate this:

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.

  1. Post:412

    Points:2888
    Re: Buttons not accessible in Wpf Codebehind

    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
    }

      Modified On Apr-04-2018 02:03:23 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!