WPF Layout: Margin Vs Padding

In the Windows UI world, Margin is a property of the FrameworkElement class, whereas Padding is a Control and Border class property. So, for all Control- and Border- derived classes, both these properties are present and have the following behavior:

Margin represents the distance between one side of a User Interface (UI) element and the adjacent UI element or the container's limit. For instance, the distance between a TextBox and a Button to its right will be the TextBox's right margin width + the Button's left margin width.

Padding represents the distance between the side of the control (which can be the margin) and its content. The content depends on the type of the control.

Margin is outside the UI element, while Padding is inside it.

Ebook Download
View all
View all
F11Research & Development, LLC