Since v11.1 XamDockManager has "AllowMaximizeFloatingWindows".
This is much appreciated but the doubleclick behavior is not exactly what I am looking for.
I would like to intercept the doubleclick on the contentpane's titlebar and toggle the fullscreen property instead of the docking property (like in VS2010). So my questions are:
- How to detect the docking state of a contentpane e.g. docked, floating?
- How to detect the window state of a contentpane e.g. minimized, normal, maximized?
- How to change the docking and window state?
LCIGmbH said: would like to intercept the doubleclick on the contentpane's titlebar and toggle the fullscreen property instead of the docking property (like in VS2010).
With regards to intercepting the double click, there is no event surfaced for this so at best you would have to derive a class from PaneToolWindow, override the OnDoubleClickCaption and do your processing there. To use your derived PaneToolWindow you would need to derive from XamDockManager as well and override the CreatePaneToolWindow factory method.
LCIGmbH said:How to detect the docking state of a contentpane e.g. docked, floating?
LCIGmbH said:How to detect the window state of a contentpane e.g. minimized, normal, maximized?
LCIGmbH said:How to change the docking and window state?
There is no docking state property for a ContentPane as its state is based on where it is located and moving it requires setting up where it will be placed. The only exposed means of changing a pane's location are via it's available ContentPaneCommands - e.g. TogglePinnedState (flips the IsPinned property), ToggleDockedState (toggles between the docked and floating dockable states), ChangeToFloatingOnly (puts the pane into floating window that does not participate in the docking), etc. Aside from that you would need to remove the ContentPane from it's parent and parent it where you wanted it placed.
Thanks, that works although I would prefer a more direct approach without writing my own classes which inherits from yours
Anyway, the next problem is that once the window is maximized (even when using the maximize button, so this has nothing to do with my modification) when you select the title bar of the maximized window (single click, not drag or doublelick) the windowstate immediately changes back to "normal". First, this is not a normal behavior, I would expect it to be just selected. A doubleclick is normally always necessary to change the window state. Second: how to intercept this and change the behavior? (Should I open a question for that?)
Well that sounds great but I was using WPF v11.1 (the installer doesn't show me a version but it seems to be build 1002, SR2009 for the .NET part) and following your suggestion I downloaded the latest WPF-SR which is 2053 but after installing I suddenly get problems with code which was running just fine before:
- In XamDataTree.SelectedNodesCollectionChanged: ((NodeSelectionEventArgs)args).CurrentSelectedNodes.Tree.ActiveNode is suddenly null when before it was pointing to the correct element.
- If I ignore this error and temporarily do nothing in this event I get the following error: "An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dllAdditional information: Collection was modified; enumeration operation may not execute."
Where can I report this?
HI LCIGmbh,
I have created a case for your XamDataTree issue and have sent you an email regarding this issue. Sincerely,
Matt Developer Support Engineer
Please tell me how to set a contentpane in XamDockManager to float and also having Minimize and Maximize buttons on the pane?
Sincerely,
Khanh
Hello Khanh,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I handled the PaneToolWindow’s Loaded event, so I can make it minimizable and maximizable. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thank you for your example.
I would like to know how to set the floating contentpane to maximized in C#. Could you help me?
Since the PaneToolWindow is a separate Window and it is not part of the visual tree of the MainWindow, it is expected that the Styles won’t apply if you move them in the MainWindow’s Resources. Only the Styles in the App.xaml’s Resources are applied to all the elements of the application.
Hope this helps you.
Stefan,
Thank you very much for your help. Is it possible to move the Style and code to Window.Resources ? Since I tried it but it would not work in Window.Resources.
I have modified the sample a sent you before, so now it works as you want. Basically I set the WindowState Property of the PaneToolWindow in its Loaded event, which I handled in the App.xaml file.