Hi, I using one header control in wpf application in that I am using Grid and in that grid I am putting List box some buttons and text box. I want to make that text box scrollable. Can you please give me the solution
I have tried this but it is not working <Label Content="Log Details" Grid.Row="4" ></Label> <Border Margin="7,7,7,3" Grid.Row="5"> <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="5" > <StackPanel > <TextBox Margin="5" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" IsReadOnly="True" x:Name="LogDetails"></TextBox> </StackPanel> </ScrollViewer> </Border> I am putting this in headercontrol.
jolly
2009-11-17 06:36:49
+5
A:
For a TextBox set its following properties:
<TextBox AcceptsReturn="True"
VerticalScrollBarVisibility="Auto"/>
You said:
I have tried this but it is not working <Label Content="Log Details" Grid.Row="4" ></Label> <Border Margin="7,7,7,3" Grid.Row="5"> <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="5" > <StackPanel > <TextBox Margin="5" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" IsReadOnly="True" x:Name="LogDetails"></TextBox> </StackPanel> </ScrollViewer> </Border> I am putting this in headercontrol. – jolly
Actually, you don't need to put a TextBox into a ScrollViewer since TextBox already has a ScrollViewer associated in its Template. But if you are having your specific requirement in which you need to do the same, you can try something like this:
<Label Content="Log Details" Grid.Row="4" ></Label>
<Border Margin="7,7,7,3" Grid.Row="5">
<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="5" >
<StackPanel>
<TextBox Margin="5" TextWrapping="Wrap" AcceptsReturn="True" IsReadOnly="True" x:Name="LogDetails"></TextBox>
</StackPanel>
</ScrollViewer>
</Border>
viky
2009-11-16 14:17:45