This documentation is archived and is not being maintained.

Pen.DashStyle Property

Gets or sets a value that describes the pattern of dashes generated by this Pen.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public DashStyle DashStyle { get; set; }
/** @property */
public DashStyle get_DashStyle ()

/** @property */
public void set_DashStyle (DashStyle value)

public function get DashStyle () : DashStyle

public function set DashStyle (value : DashStyle)

    <DashStyle .../>

Property Value

A value that describes the pattern of dashes generated by this Pen. The default is DashStyles.Solid, which indicates that there should be no dashes.

The DashStyles class provides a set of predefined dash patterns.

The following example shows how to use the DashStyle property of a Pen to create a dashed line under text.

<Page xmlns="" 
  xmlns:x="" >
  <StackPanel Margin="20">

    <TextBlock FontSize="36">
      the lazy brown dog.
        <TextDecoration Location="Underline"  
            <Pen Thickness="1.5" Brush="Red" >

              <!-- For the underline, create a dashed line with each
                   dash twice the thickness of the Pen and each gap 8 times
                   the thickness of the Pen. -->
                <DashStyle Dashes="2,8"/>

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