We have an application, in which we have requirement after clicking on Conent Paneit should be Pinned in the half of the area of Form and the other Pane/Control should be shrinked. Like it happend after clicking on Pin button. We need the same behavior after clicking on the bottom Docked Pane.
Also, how Content Pane height should be automatically adjusted to 50%.
Note: We have set UnpinnedTabHoverAction="None" in our application.
Please find the attached Sample for your refernece.
XamDockManagerCloseBtnCase.rar
Hello Narendra,
Regarding the way to ensure that the ContentPane’s height is automatically adjusted to 50%, you can set the Height of the ContentPane or the SplitPane containing the ContentPane to XamDockManager.ActualHeight / 2.
Regarding the other bits of your description, I would just like to confirm the requirement that you are looking to achieve in this case. Are you saying that you wish to essentially pin the ContentPane to the bottom when you click on it (or its header?) in this case? If this is the case, please let me know.
Please let me know if you have any other questions or concerns on this matter.
Can we set the height of Content pane in .xaml file as xamDockManager.ActualHeight/2?
Thank you for your update(s) on this matter.
Unfortunately, there does not exist a way to bind the Height of the ContentPane to a mathematical operation directly, as XAML bindings cannot do mathematical operations in that way. You could potentially use a converter and bind to the XamDockManager.ActualHeight and then return half of that value, though.
Regarding the pinning of the pane on click of its header from the DocumentContentHost, I would recommend first defining a Style for PaneTabItem with an EventSetter for PreviewMouseUp, as this will allow you to detect the click. There, you can get the Pane from the PaneTabItem to get the ContentPane and cache its Content as there does not exist a way to really move the pane programmatically. Instead, I would recommend you essentially clone the pane, close the old one, and then move the Content of the old one to the new one and add it to the XamDockManager.
After adding the cloned pane, you can execute the ContentPaneCommands.TogglePinnedState via the ExecuteCommand method of the pane to pin it.
I was unfortunately unable to use your sample project to demonstrate this as it would not compile due to missing files from the Properties folder, and so I created a new one to demonstrate the above. I am attaching this sample here.
XamDockManagerPinnedClickTest.zip
I am reattaching the sample project with an if-check around the code that recreates/clones the content panes only if the pane exists in the DocumentContentHost. This prevents the pane from auto-closing each time, as the tabs at the bottom are also PaneTabItems and as such will fire the PreviewMouseUp event in the sample.
0755.XamDockManagerPinnedClickTest.zip
Thanks for the response.
But in the Sample, I am unable to Pin/Unpin Pane1/Pane2. As after clicking on it at Bottom it's opening and closing automatically.
The expected behavior is that if we click in the bottom docked pane they should Pin automatically.