8

Is it possible to apply an outer bevel effect to the label text in WPF?

alt text

as for me, the Glow effect should be sufficient:

alt text

0

5 Answers 5

6

Here's a way to get Glow-effect on Text. Using the OutlinedText control from this link which offers Stroke.

alt text

<local:OutlinedText FontSize="100" Fill="Black" Bold="True" Stroke="White" StrokeThickness="3" Text="Glow"> <local:OutlinedText.Effect> <DropShadowEffect ShadowDepth="0" Color="White" Opacity="1" BlurRadius="12"/> </local:OutlinedText.Effect> </local:OutlinedText> 

Update
This is the closest I've come to a Bevel effect but it doesn't work very well. Used the approach from this link.

alt text

<Style x:Key="ContentControlStyle1" TargetType="{x:Type ContentControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ContentControl}"> <Grid> <TextBlock Name="Highlight" Foreground="#66FFFFFF" Text="{TemplateBinding Content}" /> <TextBlock Name="Shadow" Margin="0,4,0,0" Foreground="#CC000000" Text="{TemplateBinding Content}"/> <ContentPresenter Margin="0,2,0,0"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <ContentControl Style="{DynamicResource ContentControlStyle1}" FontSize="101" Foreground="DarkGray" Content="Bevel"/> 
Sign up to request clarification or add additional context in comments.

Comments

3

I'm not particularly happy with this 'solution':

<TextBlock Text="Hello World!" Foreground="Red"> <TextBlock.Effect> <BlurEffect Radius="1" KernelType="Box" /> </TextBlock.Effect> </TextBlock> <TextBlock Text="Hello World!" /> 

Other option is to make your own pixel shader, I'm not very good at that so I'm afraid that I cant help you :/

edit: Better solution, still not bevel though.

<TextBlock Text="Hello World!"> <TextBlock.Effect> <DropShadowEffect BlurRadius="2" Color="Red" Direction="0" ShadowDepth="0" /> </TextBlock.Effect> </TextBlock> 

2 Comments

ah, I saw the TextBlock had an effect, but I only messed around with the DropShadow effect. So, the Blur is kinda like a glow? I'll have to play with that.
@townsean ye, maybe DropShadowEffect is better to use, then you can skip the dual TextBlocks.
0

As far as i know this could of work:

<Label Content="Hi there!"> <Label.BitmapEffect> <OuterGlowBitmapEffect/> </Label.BitmapEffect> </Label> 

I have NOT tested this in a label, but i has worked for me in other controls and shapes, also, check out all the effect list IntelliSense gives you :)

10 Comments

I tried <Label.BitmapEffect><OuterGlowBitmapEffect GlowColor="White" GlowSize="5"/></Label.BitmapEffect> didn't work.. (
by the way, there is a BevelBitmapEffect too, but I didn't achieve to apply it to a label text.
Try it on a textblock instead.... it should work, ive done it before now that i remember it... :p
BitmapEffect has been deprecated, that why it does not show anything in wpf 4. Your best shot is a custom PixelShader.
Are you serious? I could of swear i used it with .NET 4 before... also, i can still use bitmapeffects on buttons and other shapes whilst using .Net 4 :p
|
0

Ah, okay I understand your problem better.

Try something like this:

<Grid> <Grid.Resources> <OuterGlowBitmapEffect GlowColor="Blue" GlowSize="5" x:key="Glow" /> </Grid.Resources> <Label Content="Blah!" BitmapEffect="{StaticResource Glow}" /> </Grid> 

I get "Blah!" with a blue glow. Seems like a decent work around since Label's content can't be set twice.

Hope that helps!

EDIT: This won't work unless you're using Framework 3.5 as BitmapEffect has been deprecated. :(

2 Comments

Attention, I want to glow(bevel) text not border.
the glow isn't showing up just around the border of the label. the text is glowy too.
0

Followintg Oggy's suggestion:

<Label.Effect> <DropShadowEffect BlurRadius="5" Color="Red" Opacity="1" ShadowDepth="0" /> </Label.Effect> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.