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.
sampleLabel.Margin = new Thickness(5); // Same as Margin=”10” in XAML
sampleLabel.Margin = new Thickness(10,5,10,5); // Same as Margin=”10,5” in XAML
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.