Example #1
0
        /// <summary>
        /// Removes the placeholder from an empty category.
        /// </summary>
        private void RemoveEmptyPlaceholder()
        {
            // Quit if the placeholder is not present
            if (emptyPlaceholderModel is null)
            {
                return;
            }

            // Ignore changes to the children collection caused by the removal of the placeholder
            ignoreChildrenCollectionChanged = true;
            try {
                this.Children.Remove(emptyPlaceholderModel);
                emptyPlaceholderModel = null;
            }
            finally {
                ignoreChildrenCollectionChanged = false;
            }
        }
Example #2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds the placeholder to an empty category.
        /// </summary>
        private void AddEmptyPlaceholder()
        {
            // Quit if the placeholder already exists
            if ((emptyPlaceholderModel != null) && this.Children.Contains(emptyPlaceholderModel))
            {
                return;
            }

            if (emptyPlaceholderModel is null)
            {
                emptyPlaceholderModel = CreateEmptyPlaceholderTreeNodeModel();
            }

            // Ignore changes to the children collection caused by the addition of the placeholder
            ignoreChildrenCollectionChanged = true;
            try {
                this.Children.Add(emptyPlaceholderModel);
            }
            finally {
                ignoreChildrenCollectionChanged = false;
            }
        }