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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:19:01+00:00 2026-06-05T10:19:01+00:00

i have a PopUp control whose IsOpen property is bound to a property named

  • 0

i have a PopUp control whose IsOpen property is bound to a property named IsOpen in a ViewModel that realizes the INotifyPropertyChanged, i want the PopUp control to close or open automatically according to value of the IsOpen of the ViewModel,i use the MVVM patterm, the code as follow:

code in the ViewModel:

public class MainViewModel : ViewModelBase
{

    private  bool _isOpen;
    public bool IsOpen
    {
        get
        {

            return this._isOpen;
        }

        set
        {
            if (this._isOpen != value)
            {
                this._isOpen = value;
                RaisePropertyChanged("IsOpen");
            }
        }
    }

}

code in the View:
//The Main is an instance of the MainViewModel below

Popup x:Name=”popUp” IsOpen=”{Binding Main.IsOpen}”

of course, there is a method in the ViewModel that used to changed the IsOpen property,i can see its change clearly,but it does not notify the view,did i miss something?thanks 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-06-05T10:19:02+00:00Added an answer on June 5, 2026 at 10:19 am

    I would create a User Control for that popup and an VM for that Control. Then I would create an instance of that user control and VM and show it from my main view model. This way you can have control over popup’s view model too.

    This solution is overengineering if you want to show just a basic popup window though.

    public class Popup: UserControl
    {
    
         public Popup(PopupVM model)
         {
             this.DataContext = model;
         }
    }
    
    public class PopupVM
    {
    ...
    }
    
    public class MainViewModel : ViewModelBase
    {
    ....
    
    // Called with an IAction
    private void ShowPopup()
    {
       PopupVM model = new PopupVM();
       this.popup = new Popup(model); // Control is a field in this VM.
       popup.Show();
    }
    
    private void ClosePopup()
    {
        // Gather some info if you want
        this.popup.Close();
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a TextBox and a Popup control. I want the Popup.IsOpen property to
I have an html page. On that page I want to open popup window.
I have an ajax control toolkit modal popup on my page and in that
I have a popup that contains a TabNavigator control. The tabs are dynamically added
I have a popup in a custom control that popups with a mouseenter event.
i have a user control that i want to build on. right now it
I need to create a custom control containing a combobox whose popup will have
I have a control that creates a popup menu on right click, and I
I have developed a control in C#. Among other things this control can popup
i have popup-window in my script. I use window.open, but almost all browsers block

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.