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

FormattedText.MinWidth Property

Gets a value that represents the smallest possible text width that can fully contain the specified text content.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public double MinWidth { get; }
/** @property */
public double get_MinWidth ()

public function get MinWidth () : double

You cannot use this property in XAML.

Property Value

A Double value that represents the minimum text width of the text source.

The following text uses the minimum text width for the source text, which displays as multiple lines. The minimum text width corresponds to the word that has the greatest width—in this case, the word "jumped". Notice that multiple words can appear on the same line, as long as their total width does not exceed the minimum text width.

Minimum text width

Text displayed using minimum paragraph width

If the value passed to MaxTextWidth is greater than or equal to the value of MinWidth, the text is formatted without ellipsis characters.

The following example shows how to use the MinWidth property to generate the minimum text width for the formatted lines of text.

// Get the minimimum line width for the text content -- that is, the widest word.
double minWidth = formattedText.MinWidth;

// Set the maximum text width to the widest word in the text content.
formattedText.MaxTextWidth = minWidth;

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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.