Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
ContentPane with rounded Borders
posted

Hi,

I want to have a ContentPane with rounded borders. I tried doing the following but it does not seem to work.

                            <!--Style TargetType="{x:Type abc:ContentPane}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type abc:ContentPane}">
                                            <AdornerDecorator>
                                                <Border CornerRadius="5"
                                                   
                                                </Border>
                                            </AdornerDecorator>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>

 

Can anybody help me out with this?

I also wanted to be able to set my own choice of color for ContentPane header background which i was able to achieve with a similar code as above except the type i set the Backround for was PaneHeaderPresenter.

But a similar code to achieve rounder corners does not seem to work.

Thanks,

Ratish

 

 

Parents
No Data
Reply
  • 54937
    Offline posted

    Setting a CorderRadius on a Border element would provide a rounded border but it is important to realize that a Border does not bring in its content based on the corder radius - only based on the border thickness - and it doesn't clip its content's either. So the corners of a Border could well be overlayed by the child elements such as the header and content. This is unrelated to xamDockManager and is just how the WPF Border element works. You could try bringing those elements in by changing the margins around those elements or you could try adjusting the template of those elements so they too have a rounded edge (e.g. round the upper left/top of the border within the PaneHeaderPresenter in your custom template for that element). Another approach would be to try and clip the contents of the border as is demonstrated here.

Children
No Data