views:

182

answers:

1

Hi,
I am developing a custom control derived from System.Windows.Controls.ContentControl. In the controls default template (themes\generic.xaml), I use a Border element that wraps the actual content.

Does my custom control already implement margin and padding (i.e., shrink the border according to the padding set on the custom control) or do/can I decide myself, where margin and padding are applied (i.e., set the margin and padding properties on the border element to {TemplateBinding Margin} etc.

Thanks in advance!

+2  A: 

Margin is implemented I believe all the way down in Framework element. However Padding is not. ContentControl has the "PaddingProperty" but by default it doesn't do anything. Basically you bind the MarginProperty of the Content to the Padding property of the content control.

Micah
I've been doing some experiments in the meantime. (Adding colourful borders at every level of the hierarchy) and I've come to the same conclusion. Thank you nonetheless!
SealedSun