I have a Silverlight
app where I want to give my textblock
an outline (not the textblock, the characters themselves), otherwise known as stroke
.
I found this question which works for WPF
, but is there a way to accomplish this when working with XAML/Silverlight
(PresentationFramework
is not a Silverlight
assembly)? Is there an existing implementation?
TextBlock is not editable. Use TextBox instead. Save this answer.
Adding Line Breaks You can do this with a LineBreak inline, added as an XAML element within the text. A new line will be started at the position of this element. If you have configured the text to be justified, the final line before the line break will not be expanded to fill the available width.
TextBlock is the primary control for displaying read-only text in apps.
Labels usually support single line text output while the TextBlock is intended for multiline text display. For example in wpf TextBlock has a property TextWrapping which enables multiline input; Label does not have this.
Going with @Chris W. idea, I came up with this code, although not the finest solution, it works:
<StackPanel>
<!-- With DropShadow -->
<TextBlock Foreground="#FFFF0000" Text="With DropShadow" FontSize="16">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="1" Color="#FF000000" />
</TextBlock.Effect>
</TextBlock>
<!-- No DropShadow -->
<TextBlock Foreground="#FFFF0000" Text="No DropShadow" FontSize="16" />
</StackPanel>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With