In order to handle CP closing MVVM-style, I was prepared to use the CP HeaderTemplate to include a button to which I could attach a RelayCommand, and hide the stock close button. As of the most current release, is this still the recommended way to do this? How about when the CP is not in the DCH? I haven't tried that yet, but it seems like I wouldn't be able to get the button as far to the right as the stock close button on the floating caption. Thanks.
also, I don't have to have a close button in the tab header, it just seems a logical place if I have to have a new button for the ICommand. It would be fine with me if I could somehow bind an ICommand to the stock CP close buttons. Thanks.
Hello Darryl,
Thank you for your posts!
I have been looking into then. If you want to be able to close the ContentPanes, that are inside a DocumentContentHost I can suggest to set the TabHeaderTemplate property to a custom template, that has a button and TextBlock in it.
In order for the button to look like the a close button you can set its style property and apply the DocumentCloseButtonStyleKey, which is used for the other close buttons, that are in the XamDockManager. Then you can use the Close command from the ContentPaneCommands.
In order to be able to close a pane, that is not inside a DocumentContentHost you can simply set the AllowClose property of the ContentPane.
I have created a small sample application for you in order to show you the above mentioned functionality. Please find the attached sample application and feel free to let me know if you have any further questions on this matter.