I want to know is there any box model is available in WPF controls same as we have in the box model of CSS. Wherein the total width of an element is equal to
the sum of its width, borders, margins and paddings.
Is box model is available in WPF
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 5, 2011, 9:36 PM EDT
In WPF , Border and Control/Panel are separate elements. Border doesn't affect Control/Panel's width. If you need Border, you can create a separate Border element, and put your Control/Panel inside it. Margin means the space around a Control/Panel, so it also doesn't affect width. However, A Panel's children's margin does affect the parent Panel. Not all Controls have Padding. But Padding does affect that Control's width if exist. See http://msdn2.microsoft.com/en-us/library/ms751709.aspx for more information.