Hi
I a couple of things to point out ...
I have been trying out the Radial Guage, When i try to apply Control Templates to change the background and foreground it does not work, i am currently grabbing the code for the Telerik Silverlight Documentation example under the "How To" > "How to Customize the Layout of a RadialGuage "
firstly the example has a flaw i think someone forgot the add the following code or has ommitted it for some strange reason:
Style="{StaticResource NewGaugeStyle}">
so anyone who tries to use that example to customize the radial guage will find out it will not work!! because the control is not using the style which referes to the forground and background templates! and unless you look through the entire example you will not even know what is going on as there will be no error generated
Secondly,
after adding that piece of code for the radial Guage to use the style attribute to the radial Guage Telerik Xaml Element...it fails in a spectacular fashion citing:
this line which is just above the Background control template:
that the "Rect" attribute is out-of-range! what ever that means can someone please take a look at this and try to make it work as it does not work it does not seem like this example was even tested before being put in the documentation here is a link to the offending Rad Guage example
ms-help://MS.VSCC.v90/MS.VSIPCC.v90/telerik.windows.controls.silverlight/telerik.windows.controls.gauge/chart-customize-radialgauge-layout.html
It actually took some doing before i could get my code to compile using this example, the example it will work "out-of-the-box" adding the radguage in a grid and just copying and pasting the ControlTemplates in the Grid Resource...this is not true a whole lot of errors where thrown up and a lot of debugging to remove the conflicting code before i could even get it to run and get to the error in question
here is the final rendition of my code after removing as much conflicts as possible - showing that the example does not work out-of-the-box!
<Grid x:Name="grdR2"> <!--Background="#FF47ABEE"-->
<Grid.Resources>
<!--<telerik:FormatConverter x:Key="FormatConverter" /> THIS DOES NOT WORK EITHER were is it being refered from!!????-->
<RectangleGeometry x:Key="ClipGeometry" Rect="0,0,300,150" /> <!--RECT is out of range Error! WHY HOW WHAT WHERE ?????!!-->
<!-- New Background Template -->
<ControlTemplate x:Key="CustomRadialGaugeBackground" TargetType="ContentControl">
<Grid Clip="{StaticResource ClipGeometry}"
Width="{Binding Path=Width}"
Height="{Binding Path=Height}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition/>
<ColumnDefinition Width="0.15*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"/>
<RowDefinition/>
<RowDefinition Height="0.3*"/>
<RowDefinition/>
<RowDefinition Height="0.15*"/>
</Grid.RowDefinitions>
<Ellipse Stroke="#FFC4C3C2"
StrokeThickness="2"
Grid.ColumnSpan="5"
Grid.RowSpan="5">
<Ellipse.Fill>
<LinearGradientBrush StartPoint="0,0.500001" EndPoint="1,0.500001">
<GradientStop Color="#FFC8CACC" Offset="0"/>
<GradientStop Color="#FFABADAF" Offset="0.87"/>
<GradientStop Color="#FF8F9093" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Stretch="Uniform"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.Column="1"
Grid.ColumnSpan="3"
Grid.Row="1"
Grid.RowSpan="3">
<Ellipse.Fill>
<RadialGradientBrush RadiusX="0.548605"
RadiusY="0.553172"
Center="0.496522,0.498134"
GradientOrigin="0.496522,0.498134">
<RadialGradientBrush.RelativeTransform>
<TransformGroup/>
</RadialGradientBrush.RelativeTransform>
<GradientStop Color="#FF000000" Offset="0"/>
<GradientStop Color="#FF6A0600" Offset="0.296707"/>
<GradientStop Color="#FFAD1100" Offset="0.449867"/>
<GradientStop Color="#FFF11C00" Offset="0.840652"/>
<GradientStop Color="#FF780E00" Offset="0.939574"/>
<GradientStop Color="#FF000000" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Stretch="Uniform"
Opacity="0.5"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.Column="1"
Grid.ColumnSpan="3"
Grid.Row="1"
Grid.RowSpan="3">
<Ellipse.Fill>
<LinearGradientBrush StartPoint="0.499997,-0.00352026" EndPoint="0.499997,0.992959">
<GradientStop Color="#FFFF7000" Offset="0"/>
<GradientStop Color="#FFD13F00" Offset="0.482804"/>
<GradientStop Color="#FFA30F00" Offset="0.554947"/>
<GradientStop Color="#FFA30F00" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Stretch="Fill"
StrokeThickness="1"
StrokeLineJoin="Round"
Stroke="#34DC1900"
Fill="#34000000"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Grid.Column="2"
Grid.Row="2" />
</Grid>
</ControlTemplate>
<!-- New Forground Template-->
<ControlTemplate x:Key="CustomRadialGaugeForeground" TargetType="ContentControl">
<Grid
Clip="{StaticResource ClipGeometry}"
Width="{Binding Path=Width}"
Height="{Binding Path=Height}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition/>
<ColumnDefinition Width="0.15*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"/>
<RowDefinition/>
<RowDefinition Height="0.3*"/>
<RowDefinition/>
<RowDefinition Height="0.15*"/>
</Grid.RowDefinitions>
<Path Stretch="Fill"
Height="Auto"
RenderTransformOrigin="0.5,1.31"
Data="M136.99973,92.000117 C60.784439,92.000117 1.6558759,113.43244 4.7598601,101.93656 20.616215,43.211116 74.261859,0 138,0 200.39567,0 251.72642,41.847141 270.18819,98.246777 275.99955,116.00015 213.21503,92.000117 136.99973,92.000117 z"
HorizontalAlignment="Stretch"
Margin="2,2,2,8"
Grid.Column="1"
Grid.ColumnSpan="3"
Grid.Row="1"
Grid.RowSpan="1">
<Path.Fill>
<LinearGradientBrush StartPoint="0.499997,-0.29169" EndPoint="0.499997,1.57502">
<GradientStop Color="#34FFF000" Offset="0"/>
<GradientStop Color="#34FFA100" Offset="0.482804"/>
<GradientStop Color="#34FF5300" Offset="0.554947"/>
<GradientStop Color="#34FF5300" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
</Grid>
</ControlTemplate>
<!--New Template with the new fore and background -->
<ControlTemplate x:Key="CustomRadialGaugeTemplate" TargetType="Gauge:RadialGauge">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<ContentControl Template="{StaticResource CustomRadialGaugeBackground}"/>
<ItemsPresenter />
<ContentControl Template="{StaticResource CustomRadialGaugeForeground}"/>
</Grid>
</Border>
</ControlTemplate>
<!-- Style that houses the Control Templates for foreground and background-->
<Style x:Key="NewGaugeStyle" TargetType="Gauge:RadialGauge">
<Setter Property="Template" Value="{StaticResource CustomRadialGaugeTemplate}" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock x:Name="txtblkRadGuagePay" Text="91% of invoices paid within payment terms" Style="{StaticResource TextBlockStyle}" FontSize="12" FontWeight="Bold" Margin="1,0,0,0" Grid.Row="0"/>
<Gauge:RadialGauge Name="radialeGuagePay" Grid.Row="1" Margin="1,10,0,0" Style="{StaticResource NewGaugeStyle}" > <!-- Not working due to the RECT is out of range Error above on 4th line from above in code!!-->
<Gauge:RadialScale Name="radialScale" StartAngle="180" SweepAngle="180" Background="White" Radius="0.75">
<Gauge:RadialScale.MajorTick>
<Gauge:MajorTickProperties Length="0.03" TooltipFormat="Tick mark at {0}" />
</Gauge:RadialScale.MajorTick>
<Gauge:RadialScale.MiddleTick>
<Gauge:MiddleTickProperties Length="0.075" TooltipFormat="Tick mark at {0}"/>
</Gauge:RadialScale.MiddleTick>
<Gauge:RadialScale.MinorTick>
<Gauge:MinorTickProperties Length="0.025" TooltipFormat="Tick mark at {0}"/>
</Gauge:RadialScale.MinorTick>
<Gauge:RadialScale.Label>
<Gauge:LabelProperties Location="CenterOutside" TooltipFormat="Tick mark at {0}"/>
</Gauge:RadialScale.Label>
<!-- Inner Radial Scale -->
<Gauge:RadialScale Name="InnerRadialScale" MajorTickStep="20" StartAngle="180" SweepAngle="170" Radius="0.40" Background="Black">
<Gauge:RadialScale.MajorTick>
<Gauge:MajorTickProperties Background="White" Length="0.01" TooltipFormat="Tick mark at {0}"/>
</Gauge:RadialScale.MajorTick>
<Gauge:RadialScale.MiddleTick>
<Gauge:MiddleTickProperties Background="White" Length="0.075" TooltipFormat="Tick mark at {0}"/>
</Gauge:RadialScale.MiddleTick>
<Gauge:RadialScale.MinorTick>
<Gauge:MinorTickProperties Background="White" Length="0.025" TooltipFormat="Tick mark at {0}"/>
</Gauge:RadialScale.MinorTick>
<Gauge:RadialScale.Label>
<Gauge:LabelProperties TooltipFormat="Tick mark at {0}"/>
</Gauge:RadialScale.Label>
<Gauge:RadialScale.Indicators>
<Gauge:Needle Name="needleWhite" Value="30" Background="Black" Location="Inside" IsAnimated="True" />
<Gauge:Needle Name="needleRed" Value="90" Background="Red" Location="Inside" IsAnimated="True" />
</Gauge:RadialScale.Indicators>
</Gauge:RadialScale>
</Gauge:RadialScale>
<!--<Gauge:RadialScale x:Name="radialScale" Min="0" Max="100" >
<Gauge:IndicatorList>
<Gauge:Needle x:Name="needle" Height="13" Value="30" Background="White" Width="81" />
</Gauge:IndicatorList>
<Gauge:IndicatorList>
<Gauge:Needle x:Name="needle1" Value="90" Background="Red"/>
</Gauge:IndicatorList>
</Gauge:RadialScale>-->
</Gauge:RadialGauge>
</Grid>
can some one please check all this and get back to me i am putting it in this forum here for all to see so that they can avoid the whole hour i spent debugging and trying to get this to run as well as i am putting it in the ticket support for a quick reponse from telerik
Kingsley