Is there any way to initialize content view of all tabbed DockingWindow?

Docking/MDI for WPF Forum

Posted 8 months ago by Yuki
Version: 22.1.0
Avatar

Hello,

At "MvvmDocumentWindows" sample, only TextDocumentItemView(Document1.txt) is initialized after application launched.

Is there any way to initialize all content view?

Our application need to initialize all content view when it launch and layout data is loaded. (also IsVisibleChanged event is needed)

Comments (3)

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

Hello,

Our docking windows in MVVM work the same way that a normal WPF TabControl does.  There is a single ContentPresenter in each tab control's Template that displays only the selected tab's content.  This is done so that you don't have all the elements loaded in the visual tree for every tab that is open, which could affect performance when resizing the window if everything was loaded and if you had complex element hierarchies like enormous data grids.

As with TabControl, when using MVVM, the view isn't realized until the related tab is selected.

Why specifically do you need all view content loaded at launch?  Usually application state should all be available in the view-models if done properly.  And what is happening in your IsVisibleChanged event handlers?


Actipro Software Support

Posted 8 months ago by Yuki
Avatar

Hello,

Thank you for replying.

I understood that docking window work the same way as WPF TabControl.


Why specifically do you need all view content loaded at launch?

Since our DocumentWindow sometimes display large data, switching DocumentWindow takes time a bit.

We are thinking of loading all view at lauch. (Time of launch will be longer, but switching tab is faster.) 

And what is happening in your IsVisibleChanged event handlers?

We handle first IsVisibleChanged event and initialize display data.

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

Hello,

If you'd like to pre-load all your UI, you could probably create all your controls at app startup time, and store the controls you created on your document view-models.  For instance, add a Element property on your document view-model that stores the UI element you create.  Then perhaps update the ContentTemplate for the DocumentWindow to use a ContentPresenter that binds to the Element property.  That way it should pull in the pre-loaded Element when the tab is selected.


Actipro Software Support

The latest build of this product (v22.1.3) was released 24 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.