Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outer bevel effect on text in WPF

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

like image 390
serhio Avatar asked Dec 02 '10 11:12

serhio


1 Answers

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"/>
like image 104
Fredrik Hedblad Avatar answered Sep 20 '22 05:09

Fredrik Hedblad