C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Syntax: The syntax for the margin attribute is important. We specify the left, top, right and bottom margins in that order.
Tip: We can also omit some margin numbers. We can use 1, 2, or 4 numbers. It starts from the left, and mirror on the opposite sides.
Example markup: XAML
<Window x:Class="WpfApplication5.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid Background="AliceBlue" Margin="10 20 30 40">
</Grid>
</Window>
Info: In the Margin section on this article, I show the AliceBlue background. I used AliceBlue because it is shown first in Visual Studio.
And: I am apparently too lazy to scroll down to find another color to demonstrate in my article.
Tip: The TabControl uses a gray background color "#FFE5E5E5." This comes out to a light gray color.
TabControlAnd: This color can also be adjusted. I suggest the color AliceBlue, which is first in the list.
Note: With a GridSplitter, we create adjustable user interfaces. These interfaces are more versatile than ones that cannot resize.
GridSplitterInfo: In Windows Forms, we had the TableLayoutPanel to organize controls in this way. The Grid serves a similar purpose.
TableLayoutPanel