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

  • Home
  • SEARCH
  • 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 3440278
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:24:48+00:00 2026-05-18T08:24:48+00:00

WPF – From Window1 I’m trying to maximize a previously minimized Window2. This is

  • 0

WPF – From Window1 I’m trying to maximize a previously minimized Window2.

This is how I am opening Window2 (I hope to use the same button to maximize it)

 public partial class Window1 : Window
{

    private bool SecondWindowOpen = false;

    public Window1()
    {
        InitializeComponent();
    }

    private void OpenSecondWindow_Click(object sender, RoutedEventArgs e)
    {
        if (SecondWindowOpen == false)
        {
            new Window2().Visibility = Visibility.Visible;
            this.SecondWindowOpen = true;

        }

        else
        {


        }
    }
}

Window2 has 2 buttons, one minimizes Window2 while the other closes it.

public partial class Window2 : Window
{
    public Window2()
    {
        InitializeComponent();
    }

    private void btnMinimize_Click(object sender, RoutedEventArgs e)
    {
        this.WindowState = WindowState.Minimized;
    }

    private void btnClose_Click(object sender, RoutedEventArgs e)
    {
        Close();
    }
}

So after opening Window2, I click btnMinimize. Now I’m back in Window1 and would like to click OpenSecondWindow and return Window2 to its original position. I would think this is a syntax issue, but I have been unable to find any examples.

Thank You

  • 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-18T08:24:48+00:00Added an answer on May 18, 2026 at 8:24 am
    public partial class Window1 : Window
    {
    
        private bool SecondWindowOpen = false;
        private Window2 window2;
    
        public Window1()
        {
            InitializeComponent();
        }
    
        private void OpenSecondWindow_Click(object sender, RoutedEventArgs e)
        {
            if (SecondWindowOpen == false)
            {
                window2 = new Window2();
                window2.Visibility = Visibility.Visible;
                this.SecondWindowOpen = true;
            }
            else
            {
                //do whatever you want with window2, like window2.Close();
                //or window2.Visibility = Visibility.Hidden;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In WPF I would use an ObjectDataProvider. This dosn't seem to be available in
WPF application, uses a Window dialog to enter PIN. Normally, it looks like this:
WPF allows to use subclasses of Transform to scale( ScaleTransform ), rotate( RotateTransform ),
WPF with local database application I was about to start but I faced this
Why WPF DataGrid control doesn't shows defined DisplayNameAttribute values for grid columns? However this
In WPF, is it posible to encode this into a single Path tag with
WPF, Browserlike app. I got one page containing a ListView. After calling a PageFunction
WPF's view model oriented way of doing things makes it very tempting to just
WPF doesn't provide the ability to have a window that allows resize but doesn't
WPF GridSplitter makes my Grid wider than my Window! I've got a WPF Grid

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.