Unable to add DropShadows to tick labels

2 posts, 0 answers
  1. Shane Milton
    Shane Milton avatar
    219 posts
    Member since:
    Dec 2003

    Posted 20 Oct 2009 Link to this post

    I've been trying and trying and for the life of me I cannot get dropshadows to work on tick labels. Am I missing something or is this functionality not yet available?

            <Telerik:RadGauge x:Name="radGauge"
                <TelerikGauge:LinearGauge> 
                    <TelerikGauge:LinearScale x:Name="linearScale" Min="0" Max="100" 
                                    StrokeThickness="1" Top="0.12" Left="0.5"
     
                        <TelerikGauge:LinearScale.MajorTick> 
                            <TelerikGauge:MajorTickProperties /> 
                        </TelerikGauge:LinearScale.MajorTick> 
                        <TelerikGauge:LinearScale.MiddleTick> 
                            <TelerikGauge:MiddleTickProperties Length="0.07" /> 
                        </TelerikGauge:LinearScale.MiddleTick> 
                        <TelerikGauge:LinearScale.MinorTick> 
                            <TelerikGauge:MinorTickProperties Length="0.055" /> 
                        </TelerikGauge:LinearScale.MinorTick> 
     
                        <TelerikGauge:LinearScale.Label> 
                            <TelerikGauge:LabelProperties FontWeight="Bold" Foreground="White" FontSize="9" Location="Outside"
                                <TelerikGauge:LabelProperties.Effect> 
                                    <DropShadowEffect Color="Black" BlurRadius="5" /> 
                                </TelerikGauge:LabelProperties.Effect> 
                            </TelerikGauge:LabelProperties> 
                        </TelerikGauge:LinearScale.Label> 
     
                        <TelerikGauge:RangeList> 
                            <TelerikGauge:LinearRange x:Name="greenRange" Min="0" Max="60" StartWidth="0.04" 
                                            EndWidth="0.04" Location="OverCenter" 
                                            Background="Green" BorderBrush="#7FFFFFFF" /> 
                            <TelerikGauge:LinearRange x:Name="yellowRange" Min="60" Max="80" StartWidth="0.04" 
                                            EndWidth="0.04" Location="OverCenter" 
                                            Background="Yellow" BorderBrush="#7FFFFFFF" /> 
                            <TelerikGauge:LinearRange x:Name="redRange" Min="80" Max="100" StartWidth="0.04" 
                                            EndWidth="0.04" Location="OverCenter" 
                                            Background="Red" BorderBrush="#7FFFFFFF" /> 
                        </TelerikGauge:RangeList> 
     
                        <TelerikGauge:IndicatorList> 
                            <TelerikGauge:Marker x:Name="needle" 
                                            RelativeHeight="0.04" RelativeWidth="0.08" IsAnimated="True" /> 
                        </TelerikGauge:IndicatorList> 
                    </TelerikGauge:LinearScale> 
                </TelerikGauge:LinearGauge> 
            </Telerik:RadGauge> 

    Thanks!!
    -Shane
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 21 Oct 2009 Link to this post

    Hello Shane,

    The LabelProperties element can’t be used directly to set visual effects for labels. It just set common label properties like location or font weight. To set visual effects or change label appearance you have to change label template. It can be done using ItemTemplate property of the LabelProperties object.
    <Telerik:RadGauge x:Name="radGauge">
        <TelerikGauge:LinearGauge>
            <TelerikGauge:LinearScale x:Name="linearScale" Min="0" Max="100"  
                                  StrokeThickness="1" Top="0.12" Left="0.5">
      
                <TelerikGauge:LinearScale.MajorTick>
                    <TelerikGauge:MajorTickProperties />
                </TelerikGauge:LinearScale.MajorTick>
                <TelerikGauge:LinearScale.MiddleTick>
                    <TelerikGauge:MiddleTickProperties Length="0.07" />
                </TelerikGauge:LinearScale.MiddleTick>
                <TelerikGauge:LinearScale.MinorTick>
                    <TelerikGauge:MinorTickProperties Length="0.055" />
                </TelerikGauge:LinearScale.MinorTick>
      
                <TelerikGauge:LinearScale.Label>
                    <TelerikGauge:LabelProperties FontWeight="Bold" Foreground="White" FontSize="9" Location="Outside">
                        <TelerikGauge:LabelProperties.ItemTemplate>
                            <DataTemplate>
                                <TextBlock HorizontalAlignment="Center"
                                           FontFamily="{Binding Path=Properties.FontFamily}"
                                           FontSize="{Binding Path=Properties.FontSize}"
                                           Foreground="{Binding Path=Properties.Foreground}"
                                           Margin="4,2,4,2">
                                    <TextBlock.Effect>
                                        <DropShadowEffect Color="Black" BlurRadius="5" />
                                    </TextBlock.Effect>
                                    <TextBlock.Text>
                                        <Binding>
                                            <Binding.Converter>
                                                <TelerikGauge:LabelFormatConverter />
                                            </Binding.Converter>
                                        </Binding>
                                    </TextBlock.Text>
                                </TextBlock>
                            </DataTemplate>
                        </TelerikGauge:LabelProperties.ItemTemplate>
                    </TelerikGauge:LabelProperties>
                </TelerikGauge:LinearScale.Label>
      
                <TelerikGauge:RangeList>
                    <TelerikGauge:LinearRange x:Name="greenRange" Min="0" Max="60" StartWidth="0.04"  
                                            EndWidth="0.04" Location="OverCenter"  
                                            Background="Green" BorderBrush="#7FFFFFFF" />
                    <TelerikGauge:LinearRange x:Name="yellowRange" Min="60" Max="80" StartWidth="0.04"  
                                            EndWidth="0.04" Location="OverCenter"  
                                            Background="Yellow" BorderBrush="#7FFFFFFF" />
                    <TelerikGauge:LinearRange x:Name="redRange" Min="80" Max="100" StartWidth="0.04"  
                                            EndWidth="0.04" Location="OverCenter"  
                                            Background="Red" BorderBrush="#7FFFFFFF" />
                </TelerikGauge:RangeList>
      
                <TelerikGauge:IndicatorList>
                    <TelerikGauge:Marker x:Name="needle"  
                                           RelativeHeight="0.04" RelativeWidth="0.08" IsAnimated="True" />
                </TelerikGauge:IndicatorList>
            </TelerikGauge:LinearScale>
        </TelerikGauge:LinearGauge>
    </Telerik:RadGauge>


    Sincerely yours,
    Andrey Murzov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
Back to Top