or
BarSeries barSer = new BarSeries();barSer.ShowLabels = true;barSer.CombineMode = ChartSeriesCombineMode.Stack;// orBarSeries barSer = new BarSeries();barSer.ShowLabels = true;barSer.CombineMode = ChartSeriesCombineMode.Cluster;foreach (DataRow dr in dtData.Rows) { barSer.DataPoints.Add(new CategoricalDataPoint() { Category = dr["Name"], Label = string.Format("{0:N}", dr["Value"]), Value = double.Parse(dr["Value"].ToString()) }); }<telerik:RadScheduleView x:Name="ScheduleView" MinTimeRulerExtent="400" MaxTimeRulerExtent="1920" AppointmentNavigationButtonsVisibility="Never" ToolTipTemplate="{StaticResource AppointmentToolTipTemplate}" telerik:StyleManager.Theme="Windows8" GroupHeaderContentTemplateSelector="{StaticResource GroupHeaderContentTemplateSelector}"/>
this theme is definitive, but I would like to be able to change the theme's AccentColor at runtime, so I wrote a method to do this:
public static void ChangeTheme(ColorTheme theme)
{
var app = (App)Application.Current;
if (theme == app.CurrentTheme) return;
app.Resources.MergedDictionaries.Clear();
AddResourceDictionary("resources/Common.xaml");
AddResourceDictionary("resources/GeneralResources.xaml");
AddResourceDictionary("resources/MenuResources.xaml");
AddResourceDictionary("resources/DataGridResources.xaml");
AddResourceDictionary("resources/DatePickerResources.xaml");
app.CurrentTheme = theme;
try { AddResourceDictionary(string.Format(CultureInfo.InvariantCulture, "themes/{0}.xaml", theme)); }
catch { AddResourceDictionary("themes/Default.xaml"); }
Windows8Palette.Palette.AccentColor = (Color)Application.Current.Resources["ThemeColor"]; // pour le calendrier
}
private static void AddResourceDictionary(string source)
{
var resourceDictionary = Application.LoadComponent(new Uri(source, UriKind.Relative)) as ResourceDictionary;
Application.Current.Resources.MergedDictionaries.Add(resourceDictionary);
}
My issue is quite simple: the ScheduleView's color is always exactly one color late. i.e.:
let's say I have 3 theme colors : green, red, blue. Blue is the color at the beginning. I call the method to set the color to red, it stays blue. I call the method to set green, it becomes red, I call the color to set blue again, it becomes green, and so on...
can anybody tell me what I am doing wrong? I am at a complete lost as to how on earth this behaviour is possible...
Edit: I forgot a potentially usefull piece of information: this used to work with earlier versions of the telerik libraries (Q3 2012 as far as I remember). At the time, I used Windows8Colors.PaletteInstance, though, as it was not yet flagged as Obsolete.
The type 'DataRowView' does not contain a public property named 'DateTime'.Parameter name: propertyName<Window xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="Testing.DataForm.MainWindow" Title="MainWindow" Height="350" Width="525"> <Grid> <telerik:RadDataForm Name="dataForm"/> </Grid></Window>using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using System.Data;namespace Testing.DataForm{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); GenerateSomeData(); } private void GenerateSomeData() { #region Data Generator DataTable baseTable = new DataTable(); baseTable.Columns.Add("DateTime", typeof(DateTime)); baseTable.Columns.Add("Value", typeof(decimal)); DateTime date = new DateTime(DateTime.Now.Year, 11, 1); TimeSpan span = date.AddMonths(1).AddDays(-1) - date; int numDays = span.Days; int randHigh = 65; int randLow = 0; #region RANDOM DATA GENERATOR Random rand = new Random(); int calculatedNumHours = 24 * numDays; for (int hour = 1; hour <= calculatedNumHours; hour++) { baseTable.Rows.Add(new object[] { date.AddHours(hour).AddSeconds(-1), rand.NextDouble() * ((randHigh - randLow) + randLow) }); } #endregion dataForm.ItemsSource = baseTable.DefaultView; #endregion } }}<telerik:ChartTrackBallBehavior ShowIntersectionPoints="False" ShowTrackInfo="True" SnapMode="AllClosePoints" TrackInfoUpdated="ChartTrackBallBehavior_OnTrackInfoUpdated"/>) . Now in TrackInfoUpdated a would like find closest data point. Unfortunately property Context.ClosestDataPoint of TrackBallInfoEventArgs always returns first datapoint of first series regardless which datapoint is really closest. How can I detect really closest data point?
Thanks for help.
David
Hi,
I'm facing a serious problem using RadCartesianChart.
Sometimes i receive this exception :
'-1' is not a valid value for property 'Height'. at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at System.Windows.FrameworkElement.set_Height(Double value) at Telerik.Windows.Controls.ChartView.PresenterBase.ArrangeUIElement(FrameworkElement presenter, RadRect layoutSlot, Boolean setSize) at Telerik.Windows.Controls.ChartView.PointTemplateSeries.UpdatePresenters(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PointTemplateSeries.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI() at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)using System;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Ink;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using Telerik.Windows.Controls;using Microsoft.Practices.Prism.UnityExtensions;using Microsoft.Practices.Prism.Regions;using Microsoft.Practices.Prism.Modularity;using Microsoft.Practices.Unity;namespace RadDockingAndPRISM{ public class Bootstrapper : UnityBootstrapper { protected override RegionAdapterMappings ConfigureRegionAdapterMappings() { var mappings = base.ConfigureRegionAdapterMappings(); mappings.RegisterMapping(typeof(RadPaneGroup), ((IUnityContainer)Container).Resolve<RadPaneGroupRegionAdapter>()); return mappings; } protected override DependencyObject CreateShell() { Shell shell = Container.Resolve<Shell>();#if SILVERLIGHT App.Current.RootVisual = shell;#else shell.Show();#endif return shell; } //protected override IModuleCatalog GetModuleCatalog() //{ // var catalog = new ModuleCatalog(); // catalog.AddModule(typeof(ModuleA.ModuleA)); // catalog.AddModule(typeof(ModuleB.ModuleB)); // return catalog; //} protected override void ConfigureModuleCatalog() { base.ConfigureModuleCatalog(); ((ModuleCatalog)ModuleCatalog).AddModule(typeof(ModuleA.ModuleA)); ((ModuleCatalog)ModuleCatalog).AddModule(typeof(ModuleB.ModuleB)); } }}