Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
xamDataChart StackedColumnSeries: How to change colors dynamically


is it possible to change the color of the bars and the title of the legend when the chart is already created and displays chart data?

Currently I use the "SeriesCreated" event to do this, but need to change these properties when the user sets new data.

private void StackedColumnSeries_SeriesCreated(object sender, StackedSeriesCreatedEventArgs e)
            if (_classInfos == null)

            StackedFragmentSeries series = sender as StackedFragmentSeries;

            Brush columnBrush = Brushes.Transparent;
            Brush outlineBrush = Brushes.Gray;
            string title = lang.Default_Label_NotAvailable;

            //Info: The series.ValueMemberPath contains the Group Number (ClassId) + _ as prefix. e.g. "0_Value"
            string[] vals = series.ValueMemberPath.Split('_');
            if (vals.Length > 1)
                Guid classId = Guid.Empty;
                ObjectClassificationConfig classInfo;
                Guid.TryParse(vals[0], out classId);

                if (_classInfos.TryGetValue(classId, out classInfo))
                    columnBrush = new SolidColorBrush(classInfo.Color);
                    outlineBrush = new SolidColorBrush(ImageUtils.MakeDarker(classInfo.Color, 60));

                    title = classInfo.Label;

            e.Brush = columnBrush;
            e.Outline = outlineBrush;
            e.Title = title;