External bevel effect for text in WPF

Is it possible to apply an external cone effect to label text in WPF?

alt text

as for me, the Glow effect should be sufficient:

alt text

+6
wpf wpf-controls
source share
5 answers

Here you can get the Glow effect on Text. Using the OutlinedText control from this link that Stroke offers.

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 came to the Bevel effect, but it does not work very well. The approach used is 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"/> 
+5
source share

I am not very happy with this "solution":

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

Another option is to make your own pixel shader, I'm not very good at it, so I'm afraid I can not help you: /

edit: The best solution, still not bevel.

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

As far as I know, this might work:

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

I did NOT test this on a shortcut, but I worked for me in other controls and forms, I also check the entire list of effects IntelliSense gives you :)

0
source share

Oh well, 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 blue glow. Sounds like a decent job, as the contents of the shortcuts cannot be set twice.

Hope this helps!

EDIT: This will not work if you are not using Framework 3.5, since BitmapEffect is deprecated. :(

0
source share

Next suggestion:

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

All Articles