Difference b w Margin and padding-01671

Online Quiz This subjective question is related to the book/course vu isl201 Islamic Studies. It can also be found in vu isl201 Mid Term Solved Past Paper No. 2.

Question 1: Difference b/w Margin and padding
Answer:

Margin and Padding

Margin and Padding are two very similar properties that are also related to an element's size. All FrameworkElements have a Margin property, and all Controls (plus Border) have a Padding property. Their only difference is that Margin controls how much extra space gets placed around the outside edges of the element, whereas Padding controls how much extra space gets placed around the inside edges of the element.

Both Margin and Padding are of type System.Windows.Thickness, an interesting class that can represent one, two, or four double values. The meaning of these values is demonstrated in Listing 4.1, which applies various Padding and Margin settings to Label controls. The second set of Labels is wrapped in Borders because the margin settings would not be noticeable otherwise. Figure 4.2 shows the rendered result for each Label if each one is individually placed in a Canvas (a panel covered in the next chapter).

Although not shown in this figure, Margin permits negative values. Padding does not.


Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background