Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Close WPF Window From Another Window ContentRendered Event
I have 3 windows. Window1 opens Window2 in a new thread. It's just a window that says 'Loading'. Window1 also opens Window3. When Window3's ContentRendered fires I want to close Window2.
I have tried numerous things. Why is this so difficult? Maybe it isn't and I am just making it this difficult.
For Each Window In Application.Current.Window
If Window = "Window2" Then
That, of course, fails. Can someone please tell me how to do this? It's driving me crazy. Thanks for any help on this.
8/22/2022 - Mon
You can have a shared array or a data structure to store all active windows. Once window 3 loads, search the structure for the window and close it. Or the other option is to use Dispatcher.FromThread. Check out
Haha, BlueYonder...my skills are limited in WPF. I had a mistake in my code up there
For Each win In Application.Current.Window
= "winActivity" Then
Disregard. This does not work. Haha..forgot I added a DispatcherTimer to Window2. It was closing and I thought I had it.
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I found the answer on my own.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Took me a while, but I found the answer on my own.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent