BUTTONS NOT ACCESSIBLE IN WPF CODEBEHIND

jacob rasel

Total Post:88

Points:616
Posted by  jacob rasel
C# 
C#
 1864  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. Pravesh Singh

    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

    }

Answer

NEWSLETTER

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