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

The Archive Base Latest Questions

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

I have a listbox that is bound to a List<T> — this is working

  • 0

I have a listbox that is bound to a List<T> — this is working great.

I’d like to let my users double click a listbox item and open a new window that will display the “detail” view for that record. I’d like this new window to be databound to the same collection as the listbox on the original window. Because, that window has a timer, which polls a webserivce for updated data, I’d like the child (detail window) to also update when the main list updates.

Is this easily done? An example would be great, but any help is appreciated!

  • 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-12T17:22:28+00:00Added an answer on May 12, 2026 at 5:22 pm

    You could share the data directly (ie pass the SelectedItem reference to the child window), but that doesn’t help you manage behavior and state across multiple windows. If it is a read-only view that’s less of a problem, but if data is being changed it gets very problematic very quickly.

    This is a good example of the benefits of using a Model-View-? pattern. MVVM is usually the preferred pattern for WPF because WPF is designed for complete separation-of-presentation. However, in a case like this, you may want something closer to MVC (Model-View-Controller), because you really want to coordinate behavior and state between distinct UI elements.

    I would recommend a hybrid approach, let’s call it “MVVMC” just to make the acronym even longer and more awkward. Implement a ViewModel that is completely UI-agnostic, and just exposes data and data-related state/behavior–probably mostly CRUD type stuff. Then implement a Controller specific to your UI design that consumes and exposes (either by delegation or composition) the ViewModel, but encapsulates. all of the the multi-window display behavior — things enforcing one window per item, propagating close requests, etc.

    public class MyViewModel : INotifyPropertyChanged, INotifyCollectionChanged
    {
        public MyViewModel(DataModel dataModel) { ... }
    }
    
    public class MyController
    {
        public MyController(MainWindow mainWindow, ViewModel viewModel) { ... }
        public ViewModel { get { return _viewModel; } }
        public ICommand DisplayChild { ... }
    }
    

    So what you’re really doing is taking an MVVM, then inverting control so the controller can manage the multi-window UI. So the controller here would inject the ViewModel into windows (including main) as the DataContext for easy binding. It would also bind to events on the main window, launch child windows, and probably bind to child window events in order to manage them properly (eg one window per child record, close children when main closes, etc).

    I would go one step further here, implementing the controller against an interface instead of Window. This gives you some flexibility in refactoring, but more importantly allows you to unit test your controller against mocks.

    public interface IControllerChild
    {
        public void Show();
        public bool Activate();
        public void Close();
        // add other behaviors here
    }
    
    public class DetailWindow : Window, IControllerChild 
    {
        // implement other behaviors here
    }
    
    public class MockControllerChild : IControllerChild
    {
        public void Show() { IsShowing = true; ActionLog.Add(MockControllerAction.Show); }
        public void Activate() { IsShowing = false; ActionLog.Add(MockControllerAction.Activate); }
        public void Close() { IsShowing = false; ActionLog.Add(MockControllerAction.Close); } 
        public bool IsShowing { get; private set; }
        public IList<MockControllerAction> ActionLog { get; private set; }
        // mock and record other behaviors here
    }
    
    public enum MockControllerAction 
    { 
        Show, 
        Activate, 
        Close,  
        // Add other behaviors here
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a databound ListBox that is behaving strangely. The ListBox's SelectionMode property is
I have a datatemplate for my listbox: <DataTemplate x:Key=CheckBoxTextBoxItemTemplate> <StackPanel Orientation=Horizontal> <CheckBox Focusable=False IsChecked={Binding
I have a ListView Control bound to a ListCollectionView in a ViewModel. I wanted
I am developing silverlight application. I have a listbox in my application. I am
Im trying to get values from a ListBox that has multiselection and dynamic ListItems
A known issue with nesting ListBoxes in a Windows Phone 7 App is that
I've got a MainModelView which implements INotifyPropertyChanged and has a property that exposes an
When the Complete Survey button on the Expander.Header is clicked, I would like to
Starting with the stock Databound application, I have three strings: LineOne, LineTwo and LineThree.
I use OpenFileDialog class, to open and display a filename chosen. List<string> paths; private

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.