Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are Margin and Padding implemented by ContentControl?

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!

like image 310
Christian Klauser Avatar asked Jan 23 '09 16:01

Christian Klauser


1 Answers

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.

like image 166
Micah Avatar answered Sep 18 '22 13:09

Micah