This is very easy to duplicate. Open the Themes folder under the RadControls_for_Silverlight_2009_3_1314_TRIAL install folder and compile all the themes. Next, create a silverlight project, add the Chart control to the MainPage.xaml. Reference the dll from any of the compiled themes and set the Theme on the Chart control to use the compiled dll and it will not show the bars on the chart for the data that is bound to it. Remove the theme or set the control's theme to one of the built in themes and suddenly it starts to show data. Am I doing anything wrong or is this a bug? If it is a bug, is there a workaround?
Here is more detail:
In the example above, the chart named radChartBuiltInTheme shows the data, but the one named radChartCustomTheme does not.
Thanks,
Chris
Here is more detail:
<UserControl x:Class="HelloWorld.MyChart" |
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting" |
xmlns:telerikTheme="clr-namespace:Telerik.Windows.Themes.Windows7;assembly=Telerik.Windows.Themes.Windows7" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
> |
<UserControl.Resources> |
<telerikTheme:MyTheme x:Key="ChartTheme" Source="/Telerik.Windows.Themes.Windows7;Component/Themes/Telerik.Windows.Controls.Charting.xaml"/> |
</UserControl.Resources> |
<Grid x:Name="LayoutRoot"> |
<Grid.RowDefinitions> |
<RowDefinition /> |
<RowDefinition /> |
</Grid.RowDefinitions> |
<Grid.ColumnDefinitions> |
<ColumnDefinition/> |
</Grid.ColumnDefinitions> |
<telerikCharting:RadChart x:Name="radChartBuiltInTheme" Grid.Row="0" Grid.Column="0" telerik:StyleManager.Theme="Windows7" /> |
<telerikCharting:RadChart x:Name="radChartCustomTheme" Grid.Row="1" Grid.Column="0" telerik:StyleManager.Theme="{StaticResource ChartTheme}" /> |
</Grid> |
</UserControl> |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Net; |
using System.Windows; |
using System.Windows.Controls; |
using System.Windows.Documents; |
using System.Windows.Input; |
using System.Windows.Media; |
using System.Windows.Media.Animation; |
using System.Windows.Shapes; |
using Telerik.Windows.Controls.Charting; |
namespace HelloWorld { |
public partial class MyChart : UserControl { |
public MyChart() { |
InitializeComponent(); |
Dictionary<DateTime, int> values = new Dictionary<DateTime, int>(); |
values.Add(new DateTime(2006, 12, 31), 425); |
values.Add(new DateTime(2007, 12, 31), 500); |
values.Add(new DateTime(2008, 12, 31), 450); |
values.Add(new DateTime(2009, 12, 31), 400); |
DataSeries series = new DataSeries(); |
foreach (var date in values.Keys) { |
DataPoint point = new DataPoint(values[date]); |
point.XCategory = date.ToString("yyyy-MM"); |
series.Add(point); |
} |
radChartBuiltInTheme.DefaultView.ChartArea.DataSeries.Add(series); |
radChartCustomTheme.DefaultView.ChartArea.DataSeries.Add(series); |
} |
} |
} |
In the example above, the chart named radChartBuiltInTheme shows the data, but the one named radChartCustomTheme does not.
Thanks,
Chris