TextBox with Wrapping and Scrolling property WPF in VB.NET

This article defines the textbox property Wrapping and Scrolling in WPF and XAML.
  • 5885

This article defines the textbox property Wrapping and Scrolling in WPF and XAML.

Wrapping and Scrolling Text

The TextWrapping attributes sets the wrapping of text and VerticalScrollBarVisibility and HorizontalScrollBarVisibility sets the vertical and horizontal scroll bars visible.

1. Setting TextWrapping property

TextWrapping="Wrap"   

2. Setting Scrolling property

HorizontalScrollBarVisibility="Auto"

VerticalScrollBarVisibility="Visible"

For example

Drag and drop one TextBox control on the form. and set the above property of the TextBox control.

The form looks like this.

wp.gif

Figure1.gif

XAML code

<Window x:Class="MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="MainWindow" Height="350" Width="525">

    <Grid>

        <TextBox Height="33" HorizontalAlignment="Left" Margin="128,68,0,0" Name="TextBox1" VerticalAlignment="Top" Width="180" Text="Rohatash Kumar please enter something in the textbox" TextWrapping="Wrap" Background="Crimson" Foreground="Blue" HorizontalContentAlignment="Center" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible" />

    </Grid>

</Window>

 

Now run the app and test it.


wp1.gif

Figure2.gif

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.