TextDecorations Clase
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Proporciona un conjunto de decoraciones de texto predefinidas estáticas.
public ref class TextDecorations abstract sealed
public static class TextDecorations
type TextDecorations = class
Public Class TextDecorations
- Herencia
-
TextDecorations
Ejemplos
En el ejemplo siguiente, una decoración de texto tachado usa el valor de fuente predeterminado.
// Use the default font values for the strikethrough text decoration.
private void SetDefaultStrikethrough()
{
// Set the underline decoration directly to the text block.
TextBlock1.TextDecorations = TextDecorations.Strikethrough;
}
' Use the default font values for the strikethrough text decoration.
Private Sub SetDefaultStrikethrough()
' Set the underline decoration directly to the text block.
TextBlock1.TextDecorations = TextDecorations.Strikethrough
End Sub
<!-- Use the default font values for the strikethrough text decoration. -->
<TextBlock
TextDecorations="Strikethrough"
FontSize="36" >
The quick red fox
</TextBlock>
También puede especificar varias decoraciones de texto para el mismo texto. En el ejemplo siguiente, se usa un subrayado y una decoración de texto en línea para el mismo texto.
<!-- Use both an underline and overline text decoration for the same text. -->
<TextBlock TextDecorations="Underline, Overline">
The quick red fox
</TextBlock>
Puede usar el valor de cadena "None" para indicar que no hay ninguna decoración de texto en la TextDecorations colección. En el ejemplo siguiente, la TextDecorations colección se establece en "None".
<!-- Set the text decoration collection to None to indicate no decorations. -->
<TextBlock TextDecorations="None">
The quick red fox
</TextBlock>
Puede quitar todas las decoraciones de texto del texto mediante el Clear método . En el ejemplo siguiente, se borra la TextDecorations colección.
TextBlock2.TextDecorations.Clear();
TextBlock2.TextDecorations.Clear()
De forma predeterminada, Hyperlink usa un TextDecoration objeto para mostrar un subrayado. En el ejemplo de marcado siguiente se muestra un Hyperlink elemento definido con y sin un subrayado:
<!-- Hyperlink with default underline. -->
<Hyperlink NavigateUri="http://www.msn.com">
MSN Home
</Hyperlink>
<Run Text=" | " />
<!-- Hyperlink with no underline. -->
<Hyperlink Name="myHyperlink" TextDecorations="None"
MouseEnter="OnMouseEnter"
MouseLeave="OnMouseLeave"
NavigateUri="http://www.msn.com">
My MSN
</Hyperlink>
TextDecoration Los objetos pueden ser intensivos en el rendimiento para crear instancias, especialmente si tiene muchos Hyperlink objetos. Para obtener más información, vea Cómo: Especificar si un hipervínculo está subrayado.
Comentarios
Hay cuatro tipos de decoraciones de texto: línea base, sobre línea, tachado y subrayado. En el ejemplo siguiente se muestran las ubicaciones de las decoraciones de texto relativas al texto.
Ejemplo de tipos de decoración de texto
Uso de atributos XAML
<object textDecorationsProperty="textDecorationType[,textDecorationType]"/>
Valores XAML
textDecorationType Tipo de decoración de texto: Baseline, OverLine, Strikethrougho Underline. Se permite más de una decoración, con valores separados por comas. También puede especificar "None" para indicar ningún tipo de decoración de texto.
Propiedades
| Nombre | Description |
|---|---|
| Baseline |
Especifica una línea base TextDecoration. |
| OverLine |
Especifica un objeto overline TextDecoration. |
| Strikethrough |
Especifica un tachado TextDecoration. |
| Underline |
Especifica un subrayado TextDecoration. |