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 6998179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:22:41+00:00 2026-05-27T20:22:41+00:00

I have created a small window with some style. Now i want to use

  • 0

I have created a small window with some style. Now i want to use it as exactly like a MessageBox. How can i achieve it?

Edit: I am new to WPF. I tried calling it in the main window like this.

Window1 messageBox = new Window1();
messageBox.Show();
messageBox.Activate();

The problem is the newly generated window disappears just behind main window without letting me to click on the action button in it.

  • 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-27T20:22:42+00:00Added an answer on May 27, 2026 at 8:22 pm

    Use ShowDialog instead of Show method to popup the messagebox window. In this way user will hve to first close the popup or message box window before moving back to main window

     MessageWindow message= new MessageWindow();
     message.ShowDialog();
    

    Edit

    You obviously would like to have result back in the main windows right? you can do it in several ways. One simplest way could be to expose a public method in MainWindow

    public GetResult(bool result)
    {
       //your logic
    } 
    

    Create a constructor of MessageWindow that take MainWindow in parameter

     private MainWindow window;
     public MessageWindow(MainWindow mainWindow)
            {
                InitializeComponent();
                window = mainWindow;
            }
       //now handle the click event of yes and no button
      private void YesButton_Click(object sender, RoutedEventArgs e)
            { 
                //close this window
                this.Close();
                //pass true in case of yes
                window.GetResult(true);
            }
    
            private void NoButton_Click_1(object sender, RoutedEventArgs e)
            {
                //close this window
                this.Close();
                //pass false in case of no
                window.GetResult(false);
            }
     //in that case you will show the popup window like this
     MessageWindow message= new MessageWindow(this);
     message.ShowDialog();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to globalize my application. I have created a small form which asks
I have some legacy MFC apps, and I'd like to use the Cairo drawing
I have created a small Java application in which there is some code that
I have created a small php script locally that runs a java application in
I have created a small flash CS4 project that has a few custom components
I have created a small chatting application in C#, and started as a Console
I have created a small and simple android app. I tried installing it on
I have created a small parser in c using flex and bison. The parser
I have created a few small flash widgets that stream .mp3 audio from an
Small problem here. I have an event created on Facebook and am using the

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.