Gets or sets the distance between the border and its child object.
Assembly: System.Windows (in System.Windows.dll)
<Border Padding="uniform"/> - or - <Border Padding="left&right,top&bottom"/> - or - <Border Padding="left,top,right,bottom"/>
In the XAML syntaxes shown, you can use a space rather than a comma as the delimiter between values.
See Remarks for value type, value bounds, and edge-case considerations that affect both code and XAML usages of .
Dependency property identifier field: PaddingProperty
The HorizontalAlignment and VerticalAlignment properties of the Border element are Stretch by default. This causes the border to stretch to the edges of the parent container and can look the same as setting a large value. Setting HorizontalAlignment and VerticalAlignment to Center causes the Border to wrap its child element which shows the proper value.
You can set a uniform padding for all sides of the border or set a specific value for each side. For details, see Thickness.
Negative values for Thickness values are technically permitted, but should be used with caution when setting the property. Negative values cause the border to be drawn inside rather than outside the child object, but they could be used in this way for deliberate effect.
Nonintegral values of a Thickness for are technically permitted, but should generally be avoided. Nonintegral values introduce subpixel rendering, which can possibly result in antialiasing artifacts.
The following example shows how to set the property for a Border.
<Grid ShowGridLines="True" x:Name="LayoutRoot" Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Border Grid.Row="0" Grid.Column="0" Padding="10" BorderThickness="50" HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="Blue"> <Rectangle Height="100" Width="150" Fill="Red" /> </Border> </Grid>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.