TwoWay binding of floating window size

Docking/MDI for WPF Forum

Posted 6 years ago by Mike
Version: 17.2.0665
Avatar

Hi,

according to your documentation I'm binding to ContainerDockedSize to set its floating size which works fine on opening. But if the user resizes the floating document window and close it, the new size isn't saved. Is there a way to do this via binding?

 

ContainerDockedSize="{Binding Source={x:Static settings:Settings.Instance}, Path=UI.FloatingWindowSize, Mode=TwoWay}"

 

public Size FloatingWindowSize { get; set; } = new Size(300.0, 450.0);

Comments (5)

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

Hello,

Are you using our layout serialization mechanism?  That should be storing all sizes properly and will allow floating windows to restore the same size, etc.  I would recommend you use that mechanism if you aren't.  If there's a reason to not use it, could you give more information on your scenario?  Thanks!


Actipro Software Support

Posted 6 years ago by Mike
Avatar

Hi,

thanks for the reply. I'm using serialization for the tool windows to handle their layout on close/start of the whole program. But for document windows or specifically one document window I would like to save/store its size on runtime. As far as I understand the serilization always serializes the tool windows as well so using a second serilization for runtime is not exactly what I'm looking for.

Right now as workaround I'm saving the size in the window closing event of the docksite. But I wondered if there is a binding solution.

Another question, document windows if they float they have an additional windows title bar. For tool windows there is an option to disable it. Is there a way to do this for document windows as well? Or maybe as style?

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

Hi Mike,

I believe we only update the ContainerDockedSize as you resize a splitter.  The reason is that other things like an outer WPF Window resizing smaller can alter the final arranged size of the container (like TabbedMdiContainer), but if you make that outermost WPF Window larger again, you want the container to go back to what size it was last at.  That's why we only adjust it when you move a splitter or dock a docking window next to another.

That being said, if we detect a single TabbedMdiContainer within a TabbedMdiHost, we will update its DockedSize, which then updates the ContainerDockedSizes on each of its docking windows.  This change will be in the next build.

Sorry but I don't believe there is a way to disable the title bar for floating documents.


Actipro Software Support

Posted 6 years ago by Matthew Bristow
Avatar

Not to high jack this thread but I was just looking to bind to the ContainerDockedSize from my ToolWindows ViewModel. Looks like it works initially as I can see the binding in snoop, but soon as I resize the docked ToolWindow the binding is lost.

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

Hi Matt,

I just did a test of binding the property to a TextBlock.Text and as I resized a tool window, it updated fine.  If you think there is a problem, please make a new simple sample project that shows it and email that to our support address.  Be sure to exclude the bin/obj folders from the ZIP and rename the .zip file extension so it doesn't get spam blocked.  Thanks!


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.