Class Utils
Utils contains static method to perform utility functions
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Edit
Assembly: Syncfusion.Edit.Wpf.dll
Syntax
public static class Utils
Remarks
The Util class used to bound the objects and also it has format methods like GetWidth, GetFormattedText.
Methods
GetFormattedText(String, FontFamily, Double, Brush, Int32)
GetFormattedText methods is used to get the formatted text based on the text, fontfamily, fontsize, foreground parameters.
Declaration
public static FormattedText GetFormattedText(string text, FontFamily fontFamily, double fontSize, Brush foreground, int tabspaces)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to be format. |
| System.Windows.Media.FontFamily | fontFamily | Fontfamily of the text. |
| System.Double | fontSize | Fontsize of the text. |
| System.Windows.Media.Brush | foreground | Foreground of the text. |
| System.Int32 | tabspaces | Number of spaces to replace each tab with. |
Returns
| Type | Description |
|---|---|
| System.Windows.Media.FormattedText | Returns the formatted text. |
Remarks
This method used to get the formatted text with the specified fontfamily, fontsize and foreground.
GetFormattedTextDecoration(String, FontFamily, Double, Brush, ISnippetFormat)
GetFormattedTextDecoration method used to get the formatted text and text decoration based on the text, fontfamily, fontsize, foreground,format parameters.
Declaration
public static FormattedText GetFormattedTextDecoration(string text, FontFamily fontFamily, double fontSize, Brush foreground, ISnippetFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | |
| System.Windows.Media.FontFamily | fontFamily | |
| System.Double | fontSize | |
| System.Windows.Media.Brush | foreground | |
| ISnippetFormat | format |
Returns
| Type | Description |
|---|---|
| System.Windows.Media.FormattedText | Returns the formatted and decorated text |
GetHeight(String, FontFamily, Double, Brush, Int32)
GetHeight method used to calculate the text height based on the text, fontfamily, fontsize and foreground
Declaration
public static double GetHeight(string text, FontFamily fontFamily, double fontSize, Brush foreground, int tabspaces)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to format. |
| System.Windows.Media.FontFamily | fontFamily | Fontfamily of the text. |
| System.Double | fontSize | Fontsize of the text. |
| System.Windows.Media.Brush | foreground | Foreground of the text. |
| System.Int32 | tabspaces | Number of spaces to replace each tab with. |
Returns
| Type |
|---|
| System.Double |
Remarks
This method used to calculate the width of the text.
GetWidth(String, FontFamily, Double, Brush, Int32)
GetWidth method used to calculate the text width based on the text, fontfamily, fontsize and foreground
Declaration
public static double GetWidth(string text, FontFamily fontFamily, double fontSize, Brush foreground, int tabspaces)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to measure. |
| System.Windows.Media.FontFamily | fontFamily | The font family. |
| System.Double | fontSize | The font size. |
| System.Windows.Media.Brush | foreground | The brush used to render the text. |
| System.Int32 | tabspaces | Number of spaces to replace each tab with. |
Returns
| Type | Description |
|---|---|
| System.Double | The measured width including trailing whitespace. |
Remarks
This method used to calculate the width of the text.