I have WPF application, In one of My WPF form has TextBlock. I placed TextBlock inside ScrollViewer for providing scrolling functionality. I want Border on TextBlock so, I have written following code in XAML
.
<ScrollViewer Margin="230,32,12,147">
<Border BorderThickness="1" BorderBrush="Black">
<TextBlock Name="textBlock1"></TextBlock>
</Border>
</ScrollViewer>
With scrollBar GUI displayed like below.
Bottom Border display on scroll down to the TextBlock. User Experience is not good for this design. So, I tried with below code but Border is not displaying.
<Border BorderThickness="1" BorderBrush="Black">
<ScrollViewer Margin="230,32,12,147">
<TextBlock Name="textBlock1"></TextBlock>
</ScrollViewer>
</Border>
How I can display Border When TextBlock placed inside ScrollViewer?
Set border in ScrollViewer control!
<ScrollViewer Margin="230,32,12,147" BorderThickness="5">
<TextBlock Name="textBlock1"></TextBlock>
</ScrollViewer>
In properties window, expand Other
group and set BorderThickness
Next code works well:
<ScrollViewer Height="116" Margin="115,112,0,0" Width="269">
<Border BorderBrush="Silver" BorderThickness="5" Height="100" Width="200">
<TextBlock Height="69" Name="textBlock1" Text="TextBlock" />
</Border>
</ScrollViewer>
Code example for outside border:
<Border BorderBrush="Silver" BorderThickness="5" Height="100" HorizontalAlignment="Left" Margin="167,104,0,0" Name="border1" VerticalAlignment="Top" Width="200">
<ScrollViewer Height="83" Name="sv" Width="184">
<TextBlock Name="textBlock1" Text="TextBlock TextBlockTextBlockTextBlock TextBlock TextBlock TextBlock TextBlock TextBlockTextBlockTextBlock TextBlock TextBlock TextBloc TextBlock TextBlockTextBlockTextBlock TextBlock TextBlock TextBloc TextBlock TextBlockTextBlockTextBlock TextBlock TextBlock TextBloc" TextWrapping="Wrap" />
</ScrollViewer>
</Border>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.