Completed
Last Updated: 03 Jun 2019 14:33 by ADMIN
Release 2019.2.603.360 (R2 2019 minor release)
Shawn
Created on: 06 Feb 2019 13:58
Category: TreeView
Type: Bug Report
0
TreeView: [iOS] Unexpected behavior when ItemsSource is cleared or updated at runtime
When the collection set as ItemsSource of the TreeView is cleared and new item is added, an exception of type NSInternalInconsistencyException is raised on iOS.
Also clearing the ItemsSource is not reflected in TreeView.
2 comments
ADMIN
Yana
Posted on: 07 Feb 2019 14:27
Hello Shawn,

Thanks for the clarification.

Indeed, the issue is observed in other situations as well - I have updated the bug report details.

I am sorry for any inconvenience caused.

Regards,
Yana
Progress Telerik
Shawn
Posted on: 06 Feb 2019 15:18

This has NOTHING to do with OnAppearing!  The same crash occurs with a ToolbarItem action:

 

    public class MainPage : ContentPage
    {
        private ObservableCollection<EntityItem> _rows = null;

        public MainPage()
        {
            Title = "Main";
            ToolbarItem loadTBI = new ToolbarItem {
                Text = "Load"
            };
            loadTBI.Clicked += HandleLoadClicked;
            ToolbarItems.Add(loadTBI);
            _rows = new ObservableCollection<EntityItem>();
            RadTreeView treeV = new RadTreeView {
                ItemsSource = _rows
            };
            treeV.Descriptors.Add(new TreeViewDescriptor {
                TargetType = typeof(EntityItem),
                DisplayMemberPath = nameof(EntityItem.Name),
                ItemsSourcePath = nameof(EntityItem.Children)
            });
            Content = treeV;
        }

        private void HandleLoadClicked(object sender, EventArgs e)
        {
            _rows.Clear();
            _rows.Add(new EntityItem { Name = "Hello" });
        }

        protected override void OnAppearing()
        {
            base.OnAppearing();
            //_rows.Clear();
            _rows.Add(new EntityItem { Name = "Hello" });
        }
    }

    public class EntityItem
    {
        public string Name { get; set; }
        public List<EntityItem> Children { get; set; }
    }