SelectionChanged has unexpected content (Selector)

Docking/MDI for WPF Forum

Posted 11 years ago by Martin de Jong - Statistics Netherlands
Version: 4.5.0483
Avatar
After adding an eventhandler to a tabbedMdiHost

<docking:TabbedMdiHost x:Name="tabbedMdiHost" Selector.SelectionChanged="tabbedMdiHost_SelectionChanged">    
in your demo "Tabbed MDI-Only QuickStart" i noticed a strange content of the arguments variable 'e'. After i delete and successive add a document, variable 'e.RemovedItems' still contains the last deletion. Is this meant to be that way?

Regards
Martin

Comments (1)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Martin,

The SelectionChanged event appears to be working as designed. The RemovedItems contain the items that are no longer selected, not items that were actually removed (a.k.a. closed). If you add the following code to your event handler, you should see that the RemovedItems always contains the document that was previously selected.
if (null != e.RemovedItems) {
    foreach (object obj in e.RemovedItems)
        System.Diagnostics.Debug.WriteLine(string.Format("****REMOVED: {0}", obj));
}
if (null != e.AddedItems) {
    foreach (object obj in e.AddedItems)
        System.Diagnostics.Debug.WriteLine(string.Format("****ADDED: {0}", obj));
}
If you are seeing something different, please let us know.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.