Select to view content in your preferred language

Adding a halo effect to text

3482
1
11-30-2011 09:31 AM
PaulLeedham
Deactivated User
Does anyone have a better method of adding a halo effect to text instead of using the following style:

<!-- Halo text symbol. -->
    <esri:TextSymbol x:Key="Halo_TextSym" OffsetX="-23" OffsetY="18">
        <esri:TextSymbol.ControlTemplate>
            <ControlTemplate>
                <Border Margin="{Binding Attributes[OffsetX]}" Width="300">
                    <Grid>
                        <TextBlock Text="{Binding Attributes[Text]}" FontSize="13" FontWeight="Bold" Foreground="White">
                     <TextBlock.Effect>
                        <DropShadowEffect Color="White" ShadowDepth="2" Direction="300" BlurRadius="7" />
                     </TextBlock.Effect>
                        </TextBlock>
                        <TextBlock Text="{Binding Attributes[Text]}" FontSize="13" FontWeight="Bold">
                     <TextBlock.Effect>
                        <DropShadowEffect Color="Yellow" ShadowDepth="0" BlurRadius="2" />
                     </TextBlock.Effect>
                        </TextBlock>
                        <TextBlock Text="{Binding Attributes[Text]}" FontSize="13" FontWeight="Bold">
                     <TextBlock.Effect>
                        <DropShadowEffect Color="White" ShadowDepth="2" Direction="60" BlurRadius="7" />
                     </TextBlock.Effect>
                        </TextBlock>
                    </Grid>
                </Border>
            </ControlTemplate>
        </esri:TextSymbol.ControlTemplate>
    </esri:TextSymbol >
0 Kudos
1 Reply
BrandonShowers
New Contributor
try this with a dynamic control template:

controlTemplate.Append(" <sdk:Label x:Name=\"testLabel\" Foreground=\"{Binding Symbol.Foreground}\" FontSize=\"{Binding Symbol.FontSize}\" Content=\"{Binding Symbol.Text}\" Background=\"#FF000000\"> ");
            controlTemplate.Append(" <sdk:Label.Effect> ");
            controlTemplate.Append(" <DropShadowEffect ShadowDepth=\"0\" BlurRadius=\"10\" Color=\"White\"> ");
            controlTemplate.Append(" </DropShadowEffect> ");
            controlTemplate.Append(" </sdk:Label.Effect> ");
            controlTemplate.Append(" </sdk:Label> ");
            controlTemplate.Append("</ControlTemplate> ");
0 Kudos