Exemplo n.º 1
0
        private void MoveTo(int nextValue)
        {
            var currentIndex = ItemSource.ToList().IndexOf(WorkingItem);
            var newIndex     = currentIndex + nextValue;

            if (newIndex < 0 || newIndex >= ItemSource.Count())
            {
                return;
            }
            WorkingItem = ItemSource.ElementAt(newIndex);
            OnPropertyChanged(nameof(WorkingItem));
        }
        /// <summary>
        /// Sort the tree view item source collection
        /// </summary>
        private void Sort()
        {
            List <DisplayableTreeViewItem> items = ItemSource.ToList <DisplayableTreeViewItem>();

            items.Sort((x, y) => CompareItems(x, y));

            ItemSource.Clear();
            for (int i = 0; i < items.Count; i++)
            {
                ItemSource.Insert(i, Sort(items[i]));
            }
        }