Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Bold Constructor (TextPointer, TextPointer)

Initializes a new instance of the Bold class, taking two TextPointer objects that indicate the beginning and end of a selection of content to be contained by the new Bold.

Namespace:  System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)

public Bold(
	TextPointer start,
	TextPointer end
)

Parameters

start
Type: System.Windows.Documents.TextPointer

A TextPointer indicating the beginning of a selection of content to be contained by the new Bold.

end
Type: System.Windows.Documents.TextPointer

A TextPointer indicating the end of a selection of content to be contained by the new Bold.

ExceptionCondition
ArgumentNullException

Raised when start or end is null.

ArgumentException

Raised when start and end do not resolve to a range of content suitable for enclosure by a Bold element, for example, if start and end indicate positions in different paragraphs.

This constructor is intended to initialize a new Bold element such that it encloses a selection of pre-existing content.

The following example demonstrates usage of this constructor.

// Create a paragraph and three text runs to serve as example content.  
Paragraph parx = new Paragraph();
Run run1 = new Run("Text run 1.");
Run run2 = new Run("Text run 2, make bold.");
Run run3 = new Run("Text run 3.");

// Add the three text runs to the paragraph, separated by linebreaks.
parx.Inlines.Add(run1);
parx.Inlines.Add(new LineBreak());
parx.Inlines.Add(run2);
parx.Inlines.Add(new LineBreak());
parx.Inlines.Add(run3);

// After this line executes, the selection of content 
// indicated by the "start" and "end" parameters will be
// enclosed by the new Bold.  In this case, the new Bold 
// will enclose the second text run, "run2".
Bold boldx = new Bold(run2.ContentStart, run2.ContentEnd);

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, 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.

Show:
© 2014 Microsoft