RadDocumentPane - Close button in the header

9 posts, 0 answers
  1. Godwin
    Godwin avatar
    8 posts
    Member since:
    Aug 2011

    Posted 19 Oct 2011 Link to this post

    Hi,

    I need to show the close button in the header rather than at the right most position of the pane(default view)! Is there any property or style settings to achieve this? Or should I extend the control!

    Thanks,
    Godwin
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 20 Oct 2011 Link to this post

    Hi Godwin,

    To achieve this, you will need to edit the templates for RadPaneGroup and RadPane.

    The RadPaneGroupTemplate contains the close button. Remove the button from the template. Instead, place it in the style for TabItemContentPresenter , which can be found in the template of RadPane.

    The button works through a Command , so there should be no problems closing the current RadPane once you have moved the button from RadPaneGroup into RadPane.

    I hope this solution will suit your scenario. If you need further assistance on this one, please let me know.

    Kind regards,
    Dani
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Godwin
    Godwin avatar
    8 posts
    Member since:
    Aug 2011

    Posted 20 Oct 2011 Link to this post

    Hi Dani,

    Can you please provide sample code for doing this?

    Regards,
    Godwin
  5. Thomas
    Thomas avatar
    13 posts
    Member since:
    Jun 2011

    Posted 20 Oct 2011 Link to this post

    Hi Godwin,

    Did you look at existing posts regarding this issue? There are several out there and two that I replied to in the last couple of days. I will repeat what I mentioned in the other posts and you can determine whether the solution is satisfactory.

    The solution I used to add a close button to the pane tab does not require creating a custom theme. I was originally going down that road but decided that it was too much reworking of the RadDocking control templates and styles. My solution uses a Style for the RadPane/RadDocumentPane and only changes the RadPane.HeaderTemplate with a DataTemplate containing the close button. Everything is contained in the header DataTemplate so you only have to create a global style for the RadDocumentPane and set the HeaderTemplate property to this DataTemplate.

    This solution does not remove the close button on the tabstrip if that is a requirement for you. Removing the close button from the tabstrip appears to require a custom theme or editing the Telerik templates, as suggested by Dani, which is more work to implement as mentioned above. I found that leaving the tabstrip close button did not pose any real issue other than a redundant means of closing the selected tab.

    You can take a look at the solution I proposed and decide if it meets your requirements.

    Here is my original post with the DataTemplate and Style defined:
    http://www.telerik.com/community/forums/wpf/docking/placing-closing-x-in-each-pane-header-as-with-vs.aspx

    Hope this helps.
  6. Godwin
    Godwin avatar
    8 posts
    Member since:
    Aug 2011

    Posted 20 Oct 2011 Link to this post

    Hi Thomas,

    I have already modified the RadDockablePane for incorporating close button. But i need to remove it from tabstrip.

    Regards,
    Godwin

  7. Godwin
    Godwin avatar
    8 posts
    Member since:
    Aug 2011

    Posted 20 Oct 2011 Link to this post

    Hi Dani,

    I am extending the RadDocumentPane using the class file(no xaml). I need to add close button to the header. Can you please guide me on how to change the header data template? Please provide some sample code.

    Regards,
    Godwin
  8. Godwin
    Godwin avatar
    8 posts
    Member since:
    Aug 2011

    Posted 21 Oct 2011 Link to this post

    Thanks for the suggestions. I could resolve this by extending both the RadPane and RadDocumentPane.

    Regards,
    Godwin
  9. Dani
    Admin
    Dani avatar
    848 posts

    Posted 25 Oct 2011 Link to this post

    Hi Godwin,

    You could indeed use a HeaderTemplate for the RadPane to include the button. The sample code which Thomas posted here is a good option. As in his sample, you would just need a button with the proper Command and CommandParameter.

    However, if you do wish to remove the close button from the tabstrip, you should edit the template of the RadPaneGroup. I attach here a sample illustrating this approach.

    If you need further help on this issue, please let me know.

    Kind regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  10. Godwin
    Godwin avatar
    8 posts
    Member since:
    Aug 2011

    Posted 25 Oct 2011 Link to this post

    Hi Dani,

    I have already implemented this!

    Thanks,
    Godwin

Back to Top
UI for WPF is Visual Studio 2017 Ready