TextBlock.FontStretch Eigenschap

Definitie

Hiermee haalt of stelt u de kenmerken van lettertype-stretching op het hoogste niveau voor de TextBlock.

public:
 property System::Windows::FontStretch FontStretch { System::Windows::FontStretch get(); void set(System::Windows::FontStretch value); };
public System.Windows.FontStretch FontStretch { get; set; }
member this.FontStretch : System.Windows.FontStretch with get, set
Public Property FontStretch As FontStretch

Waarde van eigenschap

Een lid van de FontStretch klasse waarin de gewenste teken-stretching-kenmerken worden opgegeven die moeten worden gebruikt. De standaardwaarde is Normal.

Voorbeelden

In het volgende voorbeeld ziet u hoe u het FontStretch kenmerk van een TextBlock element instelt.

<TextBlock 
  Name="textBlock"
  
  Background="AntiqueWhite" 
  Foreground="Navy" 
  
  FontFamily="Century Gothic"
  FontSize="12"
  FontStretch="UltraExpanded"
  FontStyle="Italic"
  FontWeight="UltraBold"
  
  LineHeight="Auto"
  Padding="5,10,5,10"
  TextAlignment="Center"
  TextWrapping="Wrap"
  
  Typography.NumeralStyle="OldStyle"
  Typography.SlashedZero="True"
>
  <Run Background="LightGreen">Text run 1.</Run>
  <LineBreak/><Run Background="LightBlue">Text run 2.</Run>
  <LineBreak/><Run Background="LightYellow">Text run 3.</Run>
</TextBlock>

In het volgende voorbeeld ziet u hoe u de eigenschap FontStretch programmatisch instelt.

TextBlock textBlock = new TextBlock(new Run("A bit of text content..."));

textBlock.Background              = Brushes.AntiqueWhite;
textBlock.Foreground              = Brushes.Navy;

textBlock.FontFamily              = new FontFamily("Century Gothic");
textBlock.FontSize                = 12;
textBlock.FontStretch             = FontStretches.UltraExpanded;
textBlock.FontStyle               = FontStyles.Italic;
textBlock.FontWeight              = FontWeights.UltraBold;

textBlock.LineHeight              = Double.NaN;
textBlock.Padding                 = new Thickness(5, 10, 5, 10);
textBlock.TextAlignment           = TextAlignment.Center;
textBlock.TextWrapping            = TextWrapping.Wrap;

textBlock.Typography.NumeralStyle = FontNumeralStyle.OldStyle;
textBlock.Typography.SlashedZero  = true;
Dim textBlock As New TextBlock(New Run("A bit of text content..."))

textBlock.Background = Brushes.AntiqueWhite
textBlock.Foreground = Brushes.Navy

textBlock.FontFamily = New FontFamily("Century Gothic")
textBlock.FontSize = 12
textBlock.FontStretch = FontStretches.UltraExpanded
textBlock.FontStyle = FontStyles.Italic
textBlock.FontWeight = FontWeights.UltraBold

textBlock.LineHeight = Double.NaN
textBlock.Padding = New Thickness(5, 10, 5, 10)
textBlock.TextAlignment = TextAlignment.Center
textBlock.TextWrapping = TextWrapping.Wrap

textBlock.Typography.NumeralStyle = FontNumeralStyle.OldStyle
textBlock.Typography.SlashedZero = True

Opmerkingen

Alle FontStretch instellingen op onderliggende elementen overschrijven deze instelling op het hoogste niveau.

Deze afhankelijkheidseigenschap heeft ook een gekoppeld eigenschapsgebruik. In XAML is <object TextBlock.FontStretch="value".../>het gebruik, waarbij het object een objectelement is (meestal een stroomelement) dat zich in een TextBlock, bevindt en de waarde een van de eigenschapsnamen van de tekenreeksindeling van de FontStretch klasse is. In code wordt het gebruik van gekoppelde eigenschappen ondersteund door GetFontStretch en SetFontStretch. Het gebruik van gekoppelde eigenschappen is niet gebruikelijk, omdat de meeste elementen die kunnen worden opgenomen in een TextBlock ondersteuning voor een analoge niet-gekoppelde FontStretch eigenschap, die wordt TextBlock gebruikt voor rendering.

Informatie over afhankelijkheidseigenschappen

Item Waarde
Id-veld FontStretchProperty
Eigenschappen van metagegevens ingesteld op true AffectsMeasure, , AffectsRenderInherits

Van toepassing op