WPF Margin Property
Posted by Vadim on October 5, 2008
I finally decided to spend some time to learn WPF. One of the thing I learned today is Margin property.
I’m not going to describe this property here. However, I want to share with you how I memorized the sequence of margin. It goes like this: Left, Top, Right, Bottom.
The easiest way for me to remember is to start from Left and then go clock wise: Top, Right, Bottom.
There are two main reasons why I blog and both of them selfish.
First reason is because writing helps me remember and understand better new things I learn.
The second reason is that people who read my blog comment and correct any mistakes I make and that helps me to learn too.
I have a question for WPF gurus. I understand that if all margins are the same (for example left, top, right, and bottom are equal to 5), it’s possible to assign margin like this:
The both assignments with one number and four numbers make sense because Margin is of type Thickness and this struct has two constructors:
Here comes my question: I discovered that it’s possible to assign Margin declaratively with two numbers.