Effects of the enumerated values of TextWrapping. : TextBlock « Windows Presentation Foundation « VB.Net






Effects of the enumerated values of TextWrapping.

Effects of the enumerated values of TextWrapping.
       

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="WpfApplication1.Window1" Height="480" Width="640"
  Title="TextWrap Sample">
  <StackPanel Margin="0,0,0,10" Background="LightSkyBlue">
    <StackPanel Orientation="Horizontal" Margin="0,0,0,20">
      <Button Name="btn1" Background="Silver" Width="100" Click="Wrap">Wrap</Button>
      <Button Name="btn2" Background="Silver" Width="100" Click="NoWrap">NoWrap</Button>
      <Button Name="btn4" Background="Silver" Width="100" Click="WrapWithOverflow">WrapWithOverflow</Button>
    </StackPanel>
    <TextBlock Name="txt2" TextWrapping="Wrap" Margin="0,0,0,20" Foreground="Black">
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, 
      consectetuer adipiscing elit.Lorem ipsum dolor sit aet, consectetuer adipiscing elit.
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    </TextBlock>
    <TextBlock FontSize="12" Name="txt1">
      The TextWrap property is currently set to Wrap.
    </TextBlock>    
  </StackPanel>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Media

Namespace WpfApplication1

  Public Partial Class Window1
    Inherits Window
    Public Sub Wrap(sender As Object, e As RoutedEventArgs)
      txt2.TextWrapping = System.Windows.TextWrapping.Wrap
      txt1.Text = "The TextWrap property is currently set to Wrap."
    End Sub
    Public Sub NoWrap(sender As Object, e As RoutedEventArgs)
      txt2.TextWrapping = System.Windows.TextWrapping.NoWrap
      txt1.Text = "The TextWrap property is currently set to NoWrap."
    End Sub
    Public Sub WrapWithOverflow(sender As Object, e As RoutedEventArgs)
      txt2.TextWrapping = System.Windows.TextWrapping.WrapWithOverflow
      txt1.Text = "The TextWrap property is currently set to WrapWithOverflow."
    End Sub
  End Class
End Namespace

   
    
    
    
    
    
    
  








Related examples in the same category

1.Simple TextBlockSimple TextBlock
2.Simple contentSimple content
3.LineBreak inside a TextBlock
4.Semi-Transparent TextBlockSemi-Transparent TextBlock
5.TextBlock.Foreground and ImageBrushTextBlock.Foreground and ImageBrush
6.Text decorations: underlineText decorations: underline
7.Text decorations: BaselineText decorations: Baseline
8.Text decorations: StrikethroughText decorations: Strikethrough
9.Text decorations: OverlineText decorations: Overline
10.Text decorations: more than one stylesText decorations: more than one styles
11.Multi-span for TextBlockMulti-span for TextBlock
12.Setting text decorationsSetting text decorations
13.Set pen for TextDecorationsSet pen for TextDecorations
14.TextTrimming for TextBlockTextTrimming for TextBlock
15.Apply Blur Effects on UI Element TextBlockApply Blur Effects on UI Element TextBlock
16.Apply a Glow Effect to Your UI Element TextBlockApply a Glow Effect to Your UI Element TextBlock
17.Layout TextBlock in UniformGridLayout TextBlock in UniformGrid
18.Text as contentText as content
19.Text with mixed contentText with mixed content
20.Whitespace as content and as attributeWhitespace as content and as attribute
21.Preserving whitespace in mixed contentPreserving whitespace in mixed content
22.Nested TextBlockNested TextBlock
23.Enabling hyphenationEnabling hyphenation
24.Positioning a hosted Button element with BaselineAlignment along with textPositioning a hosted Button element with BaselineAlignment along with text
25.Using RenderTransformUsing RenderTransform
26.This is rotating textThis is rotating text
27.TextBox PreviewKeyDownTextBox PreviewKeyDown
28.TextBox KeyDownTextBox KeyDown
29.TextBox PreviewKeyUpTextBox PreviewKeyUp
30.TextBox KeyUpTextBox KeyUp
31.TextBox TextInputTextBox TextInput
32.Handling overflowHandling overflow
33.Use Run the mark underlink TextDecorationsUse Run the mark underlink TextDecorations
34.Simple underline decorationSimple underline decoration
35.Programmatically change the way in which TextBlock is trimmed when it exceeds the outer boundaries of its containing box.Programmatically change the way in which TextBlock is trimmed when it exceeds the outer boundaries of its containing box.