Completed
Last Updated: 27 Sep 2018 09:55 by Dimitar
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 20 Sep 2018 07:45
Category: TreeView
Type: Bug Report
2
FIX. RadTreeView - ToggleStateTypeConverter should handle converting from/to System.Windows.Forms.CheckState as well
To reproduce:

        public RadForm1()
        {
            InitializeComponent();

            BindingList<Item> items = new BindingList<Item>();
            items.Add(new Item(0,"Root", CheckState.Checked,-1));
            for (int i = 1; i < 5; i++)
            {
                items.Add(new Item(i, "Node" + i, CheckState.Checked,0));
            }
          
            this.radTreeView1.CheckBoxes = true;
            this.radTreeView1.DisplayMember = "Name";
            this.radTreeView1.ChildMember = "Id";
            this.radTreeView1.ParentMember = "ParentId";
            this.radTreeView1.CheckedMember = "IsActive";
            this.radTreeView1.AutoCheckChildNodes = true;
            this.radTreeView1.TriStateMode = true;
            this.radTreeView1.DataSource = items;
            this.radTreeView1.ExpandAll();
        }

        public class Item
        {
            public int Id { get; set; }

            public string Name { get; set; }

            public CheckState IsActive { get; set; }

            public int ParentId { get; set; }

            public Item(int id, string name, CheckState isActive, int parentId)
            {
                this.Id = id;
                this.Name = name;
                this.IsActive = isActive;
                this.ParentId = parentId;
            }
        }

Workaround: implement a TypeConverter that can handle converting from/to System.Windows.Forms.CheckState. A sample implementation for creating a custom TypeConverter is demonstrated in the following help article: https://docs.telerik.com/devtools/winforms/treeview/data-binding/togglestateconverter
0 comments