Duplicate items in ActiveViews

Docking/MDI for WPF Forum

Posted 8 years ago by ting xue
Version: 11.1.0541
Platform: Silverlight Controls
Environment: Windows XP (32-bit)
To test how to control the docking and mdi components in prism pattern, I made some modification on the Prism Integration Unity Sample source code, and found something interesting but not as expected. So I describe it below.

1. Enviroment
a) .Net Framework 4.0
b) vs 2010
c) actipro 2011.1 (build 0541)
d) prism 4
e) Win XP

2. Modifications
a) MainModule.cs

            mainRegion.Add(richTextDocumentItemViewModel, "view1");    //So that the viewmodel could be referenced 
        mainRegion.Add(textDocumentItemViewModel, "view2");
b) Shell.xaml.cs

  public partial class Shell : Window
      private IRegionManager regionManager;
      public Shell(IRegionManager regionManager)

#if PRISM2
            this.Title = "Actipro Prism v2.2 (Unity) Integration Sample";
            this.Title = "Actipro Prism v4.0 (Unity) Integration Sample";

            this.regionManager = regionManager;
        private void button1_Click(object sender, RoutedEventArgs e)
            IRegion region = regionManager.Regions["MainRegion"];
            foreach (var view in region.ActiveViews)
                textBox1.Text += view.ToString() + Environment.NewLine;

        private void button2_Click(object sender, RoutedEventArgs e)
            IRegion region = regionManager.Regions["MainRegion"];
            var view = region.GetView("view1");

        private void button3_Click(object sender, RoutedEventArgs e)
            IRegion region = regionManager.Regions["MainRegion"];
            var view = region.GetView("view2");
c)add three buttons(button1, button2, button3) and textBox1 to the shell.xaml

OK, that's all.

Now let's begin to test:

step 1. compile and run PrismIntegration.v40.Unity.exe. All the components are loaded successfully. The WelcomeDocument.rtf dock window seems to be actived.

step 2. click button1, which should append the current activeview to textBox1. But, nothing happens, as if none of the dock windows is active.

step 3. click the tab, just the tab, of WelcomeDocument.rtf dock window.

step 4. click button1 again. "ActiproSoftware.Windows.PrismIntegration.ViewModels.RichTextDocumentItemViewModel" is appended to the textBox1.

As I thought, since WelcomeDocument.rtf dock window is in the front, it should be "isActive". Am I wrong?

Let's continue. Restart the application.

Step 5. Click button3. ReadOnlyDocument is activated.

Step 6. Click button2. WelcomeDocument is activated.

Step 7. Click button3. ReadOnlyDocument is activated.

Step 8. Click button2. Attention. Nothing happens. WelcomeDocument is not activated as expected.

Step 9. Click button1. Tow lines are appended to textBox1:

Even after I active it manually and then swith to ReadOnlyDocument, WelcomeDocument can not be activacated any more. It seems like a bug in ActiveViews generation. I trace the code but have no idea about the reason. Hope you could fix it.

Thank all your team.

Comments (2)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA

The issue you describe in Step 4 is by design. There can be several selected views, but only active view. The Welcome DocumentWindow is selected in the MDI area, but the Solution Explorder ToolWindow is also selected. Both of these windows can be the active window, which effectively means it has the keyboard focus. So at any given time you can have numerous "selected" windows.

When the sample starts up, the focus is not moved to any of the windows so there is no active window (i.e. DockSite.ActiveWindow is null). You could manually move the keyboard focus to the Welcome DocumentWindow in order to make it active, or call the DocumentWindow.Activate(true) method.

For you other issue, there was a bug in our code that I have corrected for the next maintenance release.

Actipro Software Support

Posted 8 years ago by ting xue
That's great.

I am really appreciate your good job.

BTW, where and when can I find the new patch?

[Modified at 05/11/2011 12:33 AM]
The latest build of this product (v2018.1 build 0675) 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.