Why does XAML Margin not follow CSS norm?
Question
In CSS the margin order is: top right bottom left
In XAML the margin order is: left top right bottom
Is there a reason why the WPF team didn't align this to the CSS norm?
Solution
I imagine this is because margins in WinForms were declared as left, top, right, bottom. They likely thought it would be more likely to have WinForms developers move on to WPF rather than those from the web.
For reference you can check the constructor for the Padding structure on MSDN (the type used for the Margin property).
OTHER TIPS
They're not aligning to CSS norms - they're aligning with the way that Microsoft has done UI APIs in the past. I can't speak for WinForms, but in MFC coordinates are specified in the order of LTRB.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow