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... }
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
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;