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.
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

Michael PowellPosted Feb 24, 2024, 9:51 PM
So in a sense, Margin is outward facing (from the Control), whereas Padding is inward facing (again relative to Control).