PrimaryDocument equivalent for ToolWindows?

Docking/MDI for WPF Forum

Posted 3 years ago by Gareth Parris - Software Developer, McLaren
Version: 16.1.0632
Avatar

We use ToolWindows in place of documents in a nested docksite using ToolWindow inner fill mode for styling reasons.

We need to use the PrimaryDocument functionality but this does not work for ToolWindows because they are not documents.

Is there an equivalent property and event for ToolWindows so we can track the active ToolWindow on a page?

[Modified 3 years ago]

Comments (6)

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

Hi Gareth,

Your best bet then would be to use ActiveWindow.  Alternatively if that isn't working for you or is empty, you could fall back to looking at DockSite.ToolWindows and sorting by LastActiveDateTime in reverse.  That will be the order in which they were last active.


Actipro Software Support

Posted 3 years ago by Gareth Parris - Software Developer, McLaren
Avatar

Both methods almost work but unfortunately when you switch outer document windows, the inner docksite toolwindows list lastactivedatetime always gets updated so that the last toolwindow that was added is last in the list, and not the last tool window that was selected.

From my trace output...

Page 1 - I have added 4 new waveform windows...

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 1 19/05/2016 12:35:43
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 2 19/05/2016 12:35:44
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 3 19/05/2016 12:35:48
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 4 19/05/2016 12:36:02
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LastActiveWindow is: Waveform 4

Add a new docksite to create Page 2 with 4 new scatterplot windows...

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 1 19/05/2016 12:35:58
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 2 19/05/2016 12:35:58
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 3 19/05/2016 12:35:59
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 4 19/05/2016 12:37:23
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LastActiveWindow is: Scatterplot 4

Everything ok so far. Now I am going to click on ScatterPlot 2...

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 1 19/05/2016 12:35:58
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 3 19/05/2016 12:35:59
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 4 19/05/2016 12:37:23
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 2 19/05/2016 12:38:05
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LastActiveWindow is: Scatterplot 2

Great, Scatterplot to is the last active window which is what I want. 

Now I am going to click on Page 1.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 1 19/05/2016 12:35:43
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 2 19/05/2016 12:35:44
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 3 19/05/2016 12:35:48
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Waveform 4 19/05/2016 12:36:02
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LastActiveWindow is: Waveform 4

Fine, nothing changed there...

Now I am going to click back to Page 2.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 1 19/05/2016 12:35:58
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 3 19/05/2016 12:35:59
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 2 19/05/2016 12:38:05
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ordered toolwindows: Scatterplot 4 19/05/2016 12:39:16
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LastActiveWindow is: Scatterplot 4

the last added scatterplot (scatterplot 4) has been actived by the framework when switching pages back to page 2.

I needed Scatterplot 2 to be last.

Using ActiveWindow also gives the same results.

I am going to cache off a local copy of the sorted toolwindows list in my PageDockSite to get around this but ideally it be nicer if I didn't have to.

Thanks.

[Modified 3 years ago]

Posted 3 years ago by Gareth Parris - Software Developer, McLaren
Avatar

Unfortunately even caching off a local copy doesn't work because when we switch back to a page the last added toolwindow always get focus set. So as all our toolwindows are bound to IsActive it updates the cached list too.

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

Hi Gareth,

It sounds like this might be a case of you click the tab and it tries to move focus to the first focusable descendant, which could be in Scatterplot 2 for your scenario.  I would imagine a standard WPF TabControl would behave the same way.  We don't have anything specific in there focus-wise for handling nested dock sites.

If you could put together a small sample that shows this scenario and send that to our support address, we can see if there's any sort of workaround we could try and implement to help.  Please reference this thread in your email and rename the .zip file extension of what you send so it doesn't get spam blocked.  Thanks!


Actipro Software Support

Posted 3 years ago by Gareth Parris - Software Developer, McLaren
Avatar

Sample app on its way!

Answer - Posted 3 years ago by Gareth Parris - Software Developer, McLaren
Avatar

Thank you for the fix in the latest test release 16.1.0633. I can confirm my problem is now resolved.

[Modified 3 years ago]

The latest build of this product (v2019.1 build 0681) 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.