Sizing a Document Window question

Docking/MDI for WPF Forum

Posted 10 years ago by Matthew Buffington
Version: 4.5.0487
Avatar
I know I must be missing something really obvious, but when I run the following code I get a window that is rectangular and way bigger than expected. Is there another more appropriate way to set the size of a window before showing it?


DocumentWindow win = new DocumentWindow(this.dockSite);
win.StandardMdiHeight = 150;
win.StandardMdiWidth = 150;
win.Activate();


Also I've noticed a weird rendering issue when I inherit from DocumentWindow and then set the size of the window in xaml. The window is then "cut off" on the right and bottom.

Any help is appreciated!

Matthew

Comments (3)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matthew,

1) Right now the MDI windows auto-size to best fit the workspace bounds in cascade mode so they can't be set before display. Would you like us to add a TODO item to add a property on TabbedMdiHost that indicates whether to auto-size the windows or not? This way you could set those properties before opening the window and our code wouldn't overwrite it.

2) Never use Width/Height on the docking window classes. Those are meant for internal usage only since they need to remain dynamic. If you do use those properties, you may see clipping.


Actipro Software Support

Posted 10 years ago by Matthew Buffington
Avatar
So there isn't a way to say that I want a window to open at a particular size? (This is for StandardMDIHost btw) That seems odd. We tend to design windows for a particular size given the majority of our client's requirements.

Can you recommend any temporary workaround in the meantime?

Thanks!

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

Code like this should work ok for you:
DocumentWindow w = new DocumentWindow(dockSite, "test", "Test", null, new Button());
w.Activate();
w.StandardMdiWidth = 200;
w.StandardMdiHeight= 300;
That sets the width/height AFTER the window is active but with how WPF layouts work, there shouldn't really be any flicker.


Actipro Software Support

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.