Block.BorderThickness Property
.NET Framework 4.5
Gets or sets the border thickness for the element.
Namespace: System.Windows.Documents
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
<object> <object.BorderThickness> <Thickness .../> </object.BorderThickness> </object>
<object BorderThickness="uniformThickness"/> - or - <object BorderThickness="independentThickness"/> - or - <object BorderThickness="qualifiedUniformThickness"/> - or - <object BorderThickness="qualifiedIndependentThickness"/>
XAML Values
Property Value
Type: System.Windows.ThicknessA Thickness structure specifying the amount of border to apply, in device independent pixels. The default is a uniform thickness of zero (0.0).
The following example shows how to set the BorderThickness attribute of a Block element (Paragraph).
<FlowDocument> <Paragraph Name="par" BorderBrush="Blue" BorderThickness="0.25in" > <Run> Child elements in this Block element (Paragraph) will be surrounded by a blue border. </Run> <LineBreak/><LineBreak/> <Run> This border will be one quarter inch thick in all directions. </Run> </Paragraph> </FlowDocument>
The following figure shows how the preceding example renders.

The following example shows how to set the BorderThickness property programmatically.
Paragraph par = new Paragraph(); Run run1 = new Run("Child elements in this Block element (Paragraph) will be surrounded by a blue border."); Run run2 = new Run("This border will be one quarter inch thick in all directions."); par.Inlines.Add(run1); par.Inlines.Add(run2); par.BorderBrush = Brushes.Blue; ThicknessConverter tc = new ThicknessConverter(); par.BorderThickness = (Thickness)tc.ConvertFromString("0.25in");
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.