Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Padding Property

Control.Padding Property

Gets or sets the padding inside a control.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

'Declaration
<BindableAttribute(True)> _
Public Property Padding As Thickness
'Usage
Dim instance As Control
Dim value As Thickness

value = instance.Padding

instance.Padding = value
/** @property */
public Thickness get_Padding ()

/** @property */
public void set_Padding (Thickness value)

public function get Padding () : Thickness

public function set Padding (value : Thickness)

<object>
  <object.Padding>
    <Thickness .../>
  </object.Padding>
</object>
<object Padding="Thickness" .../>

Property Value

A Thickness. The default value is zero (0).

Padding is the amount of space to insert between the object and its Margin or Border. Padding is specified in the order Left, Top, Right, and Bottom. For more information, see Thickness.

The following example shows how to set the padding property of a control.

<Button Name="btn11" Padding = "5" 
        Click="ChangePadding" TabIndex="1">
  Padding
</Button>

Sub ChangePadding(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    If (btn11.Padding.Left = 5.0) Then
        btn11.Padding = New Thickness(2.0)
        btn11.Content = "Control Padding changes from 5 to 2."
    Else
        btn11.Padding = New Thickness(5.0)
        btn11.Content = "Padding"
    End If

End Sub

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft