Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Block.IsHyphenationEnabled Property

Gets or sets a value that indicates whether automatic hyphenation of words is enabled or disabled.

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
public bool IsHyphenationEnabled { get; set; }
<object IsHyphenationEnabled="bool" .../>

Property Value

Type: System.Boolean
true if automatic breaking and hyphenation of words is enabled; otherwise, false. The default is false.

The automatic word hyphenation feature enables a Block element to automatically break and hyphenate words, based on current layout conditions. This enables long words to begin on one line and continue on this next, and tends to achieve a more even distribution of white space in justified text. Words are broken and hyphenated according to standard grammar rules.

The following example shows how to set the IsHyphenationEnabled attribute of a Block element.


<FlowDocument
  TextAlignment="Justify" 
  IsOptimalParagraphEnabled="True"
  Background="LightGray"
  PageWidth="400" PageHeight="480"
>
  <Paragraph IsHyphenationEnabled="True">
    <Hyperlink NavigateUri="http://www.xbox.com/en-US/games/p/perfectdarkzero/default.htm">
      Perfect Dark Zero
    </Hyperlink>
  </Paragraph>
  <Paragraph IsHyphenationEnabled="True">
    Joanna Dark returns in the Xbox 360 exclusive <Bold>
      <Italic>Perfect Dark Zero</Italic>
    </Bold>, the
    prequel to the internationally award-winning and multi-million selling first-person shooter
    <Italic>Perfect Dark</Italic> from famed game developer Rare.
  </Paragraph>
  <Paragraph IsHyphenationEnabled="True">
    A secret war has begun between shadowy corporations bent on world domination. Joanna Dark and her father
    Jack are caught up in the fight for the future of the planet. A routine bounty hunting mission rips open
    a global conspiracy that will change Joanna's destiny—forever.
  </Paragraph>
  <Paragraph IsHyphenationEnabled="True">
    Guide Joanna Dark on her journey to become the perfect agent. Featuring a compelling and captivating story,
    <Italic>Perfect Dark Zero</Italic> plunges you into a world of corporate espionage and conspiracy. The title
    merges the excitement and intrigue of its predecessor with revolutionary game design, cutting-edge online play,
    and amazing graphics to deliver an experience that defines next-generation gaming and entertainment...
  </Paragraph>
</FlowDocument>


The following figure shows how the preceding example renders.

Screenshot: FlowDocument hyphen enabled

The following figure shows how the same example renders with the default setting of IsHyphenationEnabled=false.

Screenshot: FlowDocument with disabled hyphens

The following example shows how to set the IsHyphenationEnabled property programmatically.


Paragraph par = new Paragraph();
par.IsEnabled = true;


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.