UnhandledException while using chart from WinRT XAML Toolkit RRS feed

  • Question

  • I am using charts of WinRT XAML Toolkit in my app. In certain screens chart works fine but in certain screens it now throws UnhandledException (earlier it was working fine. I didn't update ANYHTING). I am not getting much exception details. What's wrong with the chart?

    Exception details
    System.Exception at Windows.UI.Xaml.UIElement.Measure(Size availableSize) at WinRTXamlToolkit.Controls.DataVisualization.Charting.Primitives.EdgePanel.MeasureOverride(Size constraint) at Windows.UI.Xaml.FrameworkElement.MeasureOverride(Size availableSize)
    "Error HRESULT E_FAIL has been returned from a call to a COM component."

    Here's code to regenerate it. I am doing all the stuff in code behind because in real app there would be dynamic number of charts. I request you to please try once my code. EARLIER IT WAS WORKING FINE.'

        <Style TargetType="charting:ColumnDataPoint" x:Key="MyColumnDataPointStyle">
            <Setter Property="Template">
                    <ControlTemplate TargetType="charting:ColumnDataPoint">
                                    <TextBlock Text="{Binding Tooltip}" TextAlignment="Center" />
                            <Rectangle Fill="{Binding Color}" Stroke="{Binding Color}" StrokeThickness="3" />
    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <charting:Chart x:Name="ChartSalesRevenue" Margin="70,0" /> 

    protected override void OnNavigatedTo(NavigationEventArgs e)
        ChartSalesRevenue.Series.Add(new StackedColumnSeries());
        Binding DependentBinding = new Binding();
        Binding IndependentBinding = new Binding();
        IndependentBinding.Converter = new DateToStringConverter();
        SeriesDefinition series;
        series = new SeriesDefinition();
        series.DataPointStyle = this.Resources["MyColumnDataPointStyle"] as Style;
        DependentBinding.Path = new PropertyPath("Units");
        IndependentBinding.Path = new PropertyPath("Begin_Date");
        series.DependentValueBinding = DependentBinding;
        series.IndependentValueBinding = IndependentBinding;
        series.ItemsSource = GetDataItems();
    private List<DataItem> GetDataItems()
        return new List<DataItem> 
            new DataItem("Tooltip 1", new SolidColorBrush(Colors.Red), 5, DateTime.Now.AddDays(-1)),
            new DataItem("Tooltip 2", new SolidColorBrush(Colors.Violet), 3, DateTime.Now.AddDays(1)),
            new DataItem("Tooltip 3", new SolidColorBrush(Colors.PaleGoldenrod), 22, DateTime.Now.AddDays(-2)),
            new DataItem("Tooltip 4", new SolidColorBrush(Colors.DarkBlue), 15, DateTime.Now.AddDays(2)),
            new DataItem("Tooltip 5", new SolidColorBrush(Colors.DeepPink), 9, DateTime.Now),
    public class DateToStringConverter : IValueConverter
        public object Convert(object value, Type targetType, object parameter, string Language)
            return ((DateTime)value).ToString("MMM dd, yyyy", System.Globalization.CultureInfo.InvariantCulture);
        public object ConvertBack(object value, Type targetType, object parameter, string language)
            throw new NotImplementedException();
    public class DataItem
        public DataItem(string _Tooltip, SolidColorBrush _Color, int _Units, DateTime _Begin_Date)
            Tooltip = _Tooltip;
            Color = _Color;
            Units = _Units;
            Begin_Date = _Begin_Date;
        public string Tooltip { get; set; }
        public SolidColorBrush Color { get; set; }
        public int Units { get; set; }
        public DateTime Begin_Date { get; set; }

    Wednesday, October 2, 2013 5:39 AM

All replies

  • Make sure you report this on the WinRT XAML toolkit site, and you can ask about it on their discussion list:

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, October 2, 2013 1:50 PM
  • I have no response from there, that's why I posted here.
    Thursday, October 3, 2013 3:02 AM