WPF did you know series #2: margin and padding

I’ve been reading WPF Unleashed by Adam Nathan.

I will be posting my lesson’s learnt in the form of small code snippets and useful tips.

One of the very many goes like this:

When you specify a margin or padding in XAML, you are using an implicit converter called “System.Windows.ThicknessConverter” which takes two parameters in its constructor, e.g.

The first line is the same as saying sampleLabel has a margin of 5 for all the sides.  The second line is the same as saying left/right margin of 10 and top/bottom margin of 5.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.