Completed
Last Updated: 20 Apr 2017 14:31 by ADMIN
ADMIN
Ivan Petrov
Created on: 18 Jul 2014 13:27
Category: RangeSelector
Type: Bug Report
2
FIX. RadRangeSelector - when associating RadChartView to a RadRangeSelector and then binding the chart the range selector does not render the inner chart.
If a RadChartView is set as the associated object of a RadRangeSelector and then is data bound the range selector does not render the chart in its inner element.

How to reproduce:
public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();

            this.radRangeSelector1.AssociatedControl = this.radChartView1;
        }

        BindingList<MyCustomObject> myList;
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            myList = new BindingList<MyCustomObject>();
            myList = new BindingList<MyCustomObject>();
            myList.Add(new MyCustomObject(1, "Outdoor"));
            myList.Add(new MyCustomObject(8, "Hardware"));
            myList.Add(new MyCustomObject(3, "Tools"));
            myList.Add(new MyCustomObject(6, "Books"));
            myList.Add(new MyCustomObject(2, "Appliances"));
            BarSeries barSeria = new BarSeries();
            radChartView1.Series.Add(barSeria);
            barSeria.DataSource = myList;
            barSeria.ValueMember = "MyInt";
            barSeria.CategoryMember = "MyString";
        }

        public class MyCustomObject : INotifyPropertyChanged
        {
            private int _myInt;
            private string _myString;
            public MyCustomObject(int myInt, string myString)
            {
                _myInt = myInt;
                _myString = myString;
            }
            public int MyInt
            {
                get { return _myInt; }
                set
                {
                    _myInt = value;
                    OnPropertyChanged("MyInt");
                }
            }
            public string MyString
            {
                get { return _myString; }
                set
                {
                    _myString = value;
                    OnPropertyChanged("MyString");
                }
            }
            public event PropertyChangedEventHandler PropertyChanged;
            protected virtual void OnPropertyChanged(string propertyName)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }
            }
        }
    }

Workaround: 

Set the AssociatedControl property of the range selector after binding  the chart
public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        BindingList<MyCustomObject> myList;
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            myList = new BindingList<MyCustomObject>();
            myList = new BindingList<MyCustomObject>();
            myList.Add(new MyCustomObject(1, "Outdoor"));
            myList.Add(new MyCustomObject(8, "Hardware"));
            myList.Add(new MyCustomObject(3, "Tools"));
            myList.Add(new MyCustomObject(6, "Books"));
            myList.Add(new MyCustomObject(2, "Appliances"));
            BarSeries barSeria = new BarSeries();
            radChartView1.Series.Add(barSeria);
            barSeria.DataSource = myList;
            barSeria.ValueMember = "MyInt";
            barSeria.CategoryMember = "MyString";

            this.radRangeSelector1.AssociatedControl = this.radChartView1;
        }

        public class MyCustomObject : INotifyPropertyChanged
        {
            private int _myInt;
            private string _myString;
            public MyCustomObject(int myInt, string myString)
            {
                _myInt = myInt;
                _myString = myString;
            }
            public int MyInt
            {
                get { return _myInt; }
                set
                {
                    _myInt = value;
                    OnPropertyChanged("MyInt");
                }
            }
            public string MyString
            {
                get { return _myString; }
                set
                {
                    _myString = value;
                    OnPropertyChanged("MyString");
                }
            }
            public event PropertyChangedEventHandler PropertyChanged;
            protected virtual void OnPropertyChanged(string propertyName)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }
            }
        }
    }
0 comments