SelectionChanged Stops Firing After Last Window Closed

Docking/MDI for WPF Forum

Posted 15 years ago by Andy Ver Murlen
Version: 4.5.0485
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
The SelectionChanged event on a DockingWindowContainer stops firing after the last window is closed, and then new windows are added to it...

            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        <Button Content="Add Window" Click="Button_Click" />
        <Grid Grid.Row="1">
            <docking:DockSite x:Name="uxDockSite_DockSite">
                        <docking:TabbedMdiContainer SelectionChanged="uxTabbedMdiContainer_TabContainer_SelectionChanged">                       
                            <docking:DocumentWindow Title="One" Content="One"/>
                            <docking:DockingWindow Title="Two" Content="Two" />
                            <docking:DockingWindow Title="Three" Content="Three"/>
                            <docking:DockingWindow Title="Four" Content="Four"/>

using System;
using System.Windows;
using System.Windows.Controls;
using ActiproSoftware.Windows.Controls.Docking;

namespace RibbonSample
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1
        public Window1()

        private void uxTabbedMdiContainer_TabContainer_SelectionChanged(object sender, SelectionChangedEventArgs e)
            Console.WriteLine("Selection Changed");

        private void Button_Click(object sender, RoutedEventArgs e)
            DocumentWindow window = new DocumentWindow(uxDockSite_DockSite);
            window.Title = "New Window";
Flip between the windows, and you will see "Selection Changed" output to the output window. Close all the windows and click the add button a few times. You will no longer see the selection changed event.

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Andy,

That is correct, basically for the same reason I posted in reply to your previous message. TabbedMdiContainers are added/removed dynamically at run-time. This must be done to properly support docking functionality.

If you want to track events then you should be using ones like DockSite.WindowFocused, etc.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.