DockSite & Derialized toolwindows - force screen refresh

Docking/MDI for WPF Forum

Posted 13 years ago by Bret Naughton
Version: 11.1.0543
Avatar
I am currently deserializing my toolwindows from the XML string using the Lazy Layout functionality (using this so I can either create all the toolwindows or select ones).

What I do at the moment is load the XML window positioning data and then I loop through and create/activate the toolwindows using the same window names.

What I then do is to loop through each of the displayed toolwindows and load the appropriate content for each toolwindow.

My problem is the following..... I am doing the above process, instead of creating each toolwindow and immediately loading the content, as I want the user to be presented with the layout before the process starts to load in each window's content.

What I have found is that the user is never presented with the screen layout until my entire routine has completed (i.e. the content has been loaded for all the required toolwindows). However, if I place a msgbox between the toolwindow creation routine and the routine to load the content for all toolwindows, then I see the toolwindow layout.

So, is there a way to trigger a refresh of the docksite, so that the user sees the toolwindow layout before any other code is run.

Thanks,
Bret

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

You can use UpdateLayout to force a WPF control to update it's layout. Depending on what stage the controls are in (i.e. initialized, loaded, arranged, etc), you may need to manually arrange/measure the DockSite. In general, UpdateLayout works well but can sometimes lead to other problems.


Actipro Software Support

Posted 13 years ago by Bret Naughton
Avatar
Thanks for that. Unfortunately the update does not seem to refresh the collected toolwindows.

In fact what is also happening at the moment, is that because I am opening my file (containing the toolwindow information and positioning information), the application menu just stays there until the entire process is completed (the toolwindow creation and the toolwindow content creation).

Again, the only way I get this to display as required is to place a msgbox between the toolwindows creation and the toolwindows content creation).

I have even created my own window control with a button that is displayed and then I sendkey to the button through a timer but this still does not seem to work.

So in pseudo code I do the following....

(1)
Loop through all toolwindows
Create & Activate each toolwindow
End Loop

(2)
Display message-box to update the above, to show correct layout for all 'empty' toolwindows and also clear the application menu. This is the temporary fix, but not acceptable for the user. I have also tried the update of the parent toolwindow/docksite but no luck.

(3)
Loop through all toolwindows
Add Content to each toolwindow
End Loop

(4)
At this point the screen refreshes if I have not included (2).

Thanks,
Bret
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

Sorry, but we don't have any control over when WPF decides to display/arrange/measure our controls. If you are effectively blocking the UI thread, then you'd need to rework your code so that the UI thread can continue to update the display. Possibly, but using the Dispatcher and it's BeginInvoke method to delay the code in your loops. Or maybe using a separate thread, and using Dispatcher.Invoke for UI related items.


Actipro Software Support

The latest build of this product (v24.1.1) 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.