Here is the code i wrote:
<Grid>
<Grid.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</Grid.Resources>
<TextBlock Margin="3,0,3,0" VerticalAlignment="Center"
Text="Comment here..."
FontSize="12"
Foreground="Black"
Height="35"
Visibility="{Binding ElementName=TextBox1, Path=Text.IsEmpty,
Converter={StaticResource BooleanToVisibilityConverter}}"/>
<TextBox Margin="0" Background="#AAFFFFFF"
VerticalAlignment="Top" Name="FilterTextBox"
Text="{Binding Text, UpdateSourceTrigger=PropertyChanged}"
MinLines="2"
MaxLines="2"
BorderThickness="0"
VerticalScrollBarVisibility="Auto"
MaxLength="{Binding MaxLength}"
Height="35">
</TextBox>
</Grid>
This works as desired if i enter any letters it removes comments here… but problem is i have set textbox as MinLines = 2 and scrollbar visible but both are not working. I can only enter text in one line. Can anyone please tell me what am i doing wrong? Or is there a better way to do this in wpf?
TextBox.TextWrapping Property is
TextWrapping.NoWrapby default. Set it toWraporWrapWithOverflowand it should work.