Example #1
0
        /// <summary>
        /// Gets a list of elements that represent the breadcrumb (path) to the given element
        /// from the root.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        private static NList <NXmlElement> GetBreadcrumbPath(NXmlElement element)
        {
            NList <NXmlElement> list = new NList <NXmlElement>();

            list.Add(element);
            element = (NXmlElement)element.Parent;

            while (element.Name != "document")
            {
                // A tile with only 1 child or a tile single child of a group should not be added to the breadcrumb
                if (IsPartOfBreadcrumb(element))
                {
                    list.Add(element);
                }

                element = (NXmlElement)element.Parent;
            }

            list.Reverse();
            return(list);
        }