tags:

views:

42

answers:

1

Application.Current.MainWindow. ?

+1  A: 

If your control is in the main window of your application, you most likely need to cast it to the appropriate type. For example, if your "main window" is named Window1 (default naming), you could do:

Window1 myWindow = Application.Current.MainWindow as Window1;
if (myWindow != null)
{
     Button myButton = myWindow.button1; // Use your control here...
     myButton.IsEnabled = true; // Do something with the control here...
}
Reed Copsey