Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7090939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:07:07+00:00 2026-05-28T08:07:07+00:00

Within my application, i use the hidden and visible porperties to make windows how

  • 0

Within my application, i use the hidden and visible porperties to make windows how or not show to the user.
Now at some point, when i am in Window1, i want to make a check if there is still a instance of the main window, that is hidden.
Googling, i found (also on SO) that i need to use this code:

Window deze = Application.Current.Windows.OfType<MainWindow>().Where(x => x.Name == "MainWindow").FirstOrDefault();   

But whatever i fill in for the part OfType<MainWindow> or for the "MainWindow" it keeps returning null, even when im 100% sure there must be 1 instance.

Checking in the code of the main window, that is called in the solution explorer (visual express) “mainWindow.xaml”
i see that the code looks like this:

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {      
        //creating the exitmessage for use later on, after all, we want to use this in an other method.


        public MainWindow()
        {
......
        }

I really have no clue at all, why that “Window deze” keeps returning null when im 100% sure there is a hidden instance of the main window.

Anyone got an idea on this one ?
Im i just totally overlooking some logical solution ?

thanx in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:07:08+00:00Added an answer on May 28, 2026 at 8:07 am

    The Where is redundant, as you see it checks for a specific name, which does not concern you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within the application I am writing for testing/learning C#, I use the hidden/visible property
Within my application, I use the MiniDumpWriteDump function (see dbghelp.dll) to write a crash
I'm trying to use Simple Savant within my application, to use SimpleDB I currently
So I am writing a web application for use within my organization. The application
We have a ASP .Net application whereby we use Log4Net to log details within
I am searching for free event sources that I can use within my java-application.
I have 2 attributes that I use within the controllers of my MVC application.
So within my application is a form for creating a new user, with relevant
I execute some tests within my application, but before doing that I have to
How do I utilize a user control from Application B within Application A? Application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.