This question is locked. New answers and comments are not allowed.
Hi!
I have a problem with the LabelTemplateSelector on the RadPolarChart.
I define the TemplateSelector for the items and the first time it is loaded everything works fine. Depending on the properties of the item I deside which template is returned (e.g. the property value is greater than 0 I return another template than if the value is 0).
When I change the series (I have a dropdown to select the items source which should be displayed in the polar chart) the LabelTemplateSelector is not called again. So, the template style of the labels is not up to date. How can I force the LabelTemplateSelector to be recalled?
Here is the definition of my polar chart:
This is the code which is called when the chart gets a new series:
I have a problem with the LabelTemplateSelector on the RadPolarChart.
I define the TemplateSelector for the items and the first time it is loaded everything works fine. Depending on the properties of the item I deside which template is returned (e.g. the property value is greater than 0 I return another template than if the value is 0).
When I change the series (I have a dropdown to select the items source which should be displayed in the polar chart) the LabelTemplateSelector is not called again. So, the template style of the labels is not up to date. How can I force the LabelTemplateSelector to be recalled?
Here is the definition of my polar chart:
<telerik:RadPolarChart x:Name="_polarChart"Grid.Row="0"Grid.RowSpan="2"IsEnabled="{Binding IsActiveSubstanceLoaded}"Visibility="Collapsed"> <telerik:RadPolarChart.Grid> <telerik:PolarChartGrid GridLineVisibility="Both" StripesVisibility="Both"> <telerik:PolarChartGrid.RadialStripeBrushes > <SolidColorBrush Color="Green" /> <SolidColorBrush Color="Gold" /> <SolidColorBrush Color="DarkOrange" /> <SolidColorBrush Color="Firebrick" /> </telerik:PolarChartGrid.RadialStripeBrushes> </telerik:PolarChartGrid> </telerik:RadPolarChart.Grid> <telerik:RadPolarChart.RadialAxis> <telerik:CategoricalRadialAxis LineStroke="Transparent" LabelTemplateSelector="{StaticResource MyRadPolarChartTemplateSelector}" /> </telerik:RadPolarChart.RadialAxis> <telerik:RadPolarChart.PolarAxis> <telerik:PolarAxis FontWeight="Bold" TickThickness="3" Minimum="0" Maximum="4" MajorStep="1" LineStroke="Transparent" /> </telerik:RadPolarChart.PolarAxis> <telerik:RadPolarChart.Behaviors> <telerik:ChartTooltipBehavior Placement="Top" VerticalOffset="10" /> </telerik:RadPolarChart.Behaviors> <telerik:RadPolarChart.TooltipTemplate> <DataTemplate> <Grid> <Rectangle Stretch="Fill" Fill="Beige" Stroke="Black" /> <StackPanel Margin="5,5,5,5"> <StackPanel Orientation="Horizontal"> <TextBlock Loaded="tooltipTextBlock_Loaded"/> </StackPanel> </StackPanel> </Grid> </DataTemplate> </telerik:RadPolarChart.TooltipTemplate> </telerik:RadPolarChart>private void createCharts(){ if (_polarChart != null) { _polarChart.Series.Clear(); List<RiskViewModel> currentDataPoints = _mainViewModel.AllRiskViewModels.Where(risk => risk.IsCurrent && risk.Region == _mainViewModel.SelectedRegion).ToList(); List<RiskViewModel> futureDataPoints = _mainViewModel.AllRiskViewModels.Where(risk => risk.IsFuture && risk.Region == _mainViewModel.SelectedRegion).ToList(); if (currentDataPoints.Count() == 0 && futureDataPoints.Count() == 0) { _polarChart.Visibility = Visibility.Collapsed; _tbx_noDataFound.Visibility = Visibility.Visible; return; } else { _polarChart.Visibility = Visibility.Visible; _tbx_noDataFound.Visibility = Visibility.Collapsed; } if (currentDataPoints.Count() > 0 && cbxCurrent.IsChecked.Value) { RadarLineSeries series = generateSeries(currentDataPoints, this.Resources["SeriesCurrentColor"] as SolidColorBrush); series.Stroke = this.Resources["SeriesCurrentColor"] as SolidColorBrush; _polarChart.Series.Add(series); } if (futureDataPoints.Count() > 0 && cbxFuture.IsChecked.Value) { RadarLineSeries series = generateSeries(futureDataPoints, this.Resources["SeriesFutureColor"] as SolidColorBrush); series.Stroke = this.Resources["SeriesFutureColor"] as SolidColorBrush; _polarChart.Series.Add(series); } }}private RadarLineSeries generateSeries(List<RiskViewModel> dataPoints, SolidColorBrush color){ RadarLineSeries series = new RadarLineSeries(); series.ItemsSource = dataPoints; series.CategoryBinding = new PropertyNameDataPointBinding("Category"); series.ValueBinding = new PropertyNameDataPointBinding("Score"); series.PointTemplate = createDataPointTemplate(color); return series;}