This is a migrated thread and some comments may be shown as answers.

ChartControl implicit styles for the Dark theme

1 Answer 196 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ghasem
Top achievements
Rank 1
Ghasem asked on 25 Dec 2014, 08:38 AM
Hi All, 
About setting themes and styling WPF controls using implicit styles, I set Dark style to Rad controls successfully but about  RadChart , it doesn’t work. indeed  I set dark theme to RadChart successfully using  StyleManager.
I apply implicit styles for the Dark theme in code below, 
Regards

private static void SetTelerikTheme()
        {
 
 
            //Style tbstyle = null;
 
            string themeName = "Expression_Dark";
 
 
 
 
            telerikResources = new List<ResourceDictionary>();
            AddTelerikTheme(themeName, "System.Windows.xaml");
            AddTelerikTheme(themeName, "Telerik.ReportViewer.Silverlight.xaml");
 
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Data.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.DataVisualization.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Diagrams.Extensions.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Diagrams.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Docking.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Expressions.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.FixedDocumentViewers.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.FixedDocumentViewersUI.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.GanttView.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.GridView.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.ImageEditor.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Input.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Navigation.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Pivot.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.PivotFieldList.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.RibbonView.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.RichTextBoxUI.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.ScheduleView.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Spreadsheet.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Documents.Proofing.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Documents.xaml");
            AddTelerikTheme(themeName, "Telerik.Windows.Controls.Chart.xaml");
 
            AddTelerikTheme(themeName, "Expression/Dark/ReportViewer.xaml");
            AddTelerikTheme(themeName, "Expression/Dark/ReportViewerDialogBox.xaml");
            AddTelerikTheme(themeName, "Expression/Dark/ReportViewerErrorStatus.xaml");
 
            foreach (var res in telerikResources)
                App.Current.Resources.MergedDictionaries.Add(res);
        }
 
        private static List<ResourceDictionary> telerikResources = new List<ResourceDictionary>();
 
        private static void AddTelerikTheme(string themeName, string dictionaryName)
        {
            try
            {
                telerikResources.Add(new ResourceDictionary()
                {
                    Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/" + dictionaryName,
                        UriKind.RelativeOrAbsolute)
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    dictionaryName + "\r\n" +
                    ex.Message);
            }
        }

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 25 Dec 2014, 01:16 PM
Hi Ghasem,

I am afraid that RadChart does not provide a support for implicit styling as stated in the second note in the Setting a Theme (Using Implicit Styles) help article. However, you can take a look at the new RadChartView suite instead. The new charting components have better implementation and improved performance. They are also very flexible and easy to set up compared to the RadChart control. You can read more about the differences between the components in the RadChart vs. RadChartView help article. If you are just starting to use a charting in your application I strongly recommend you to use RadChartView instead of the old chart control. One of the benefits from this decision will be better performance, also the new charting controls resolves many of the issues and limitations of RadChart.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
Ghasem
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or