Exemple #1
0
        internal override void RequestTreeItems(TreeGridRequestTreeItemsEventArgs e)
        {
            bool canPopualate = (e.ParentNode != null && e.ParentNode.ChildNodes.Any() && e.ResetChildAndRepopulate) || (e.ParentNode != null && !e.ParentNode.ChildNodes.Any()) || e.ParentNode == null;

            if (!canPopualate)
            {
                if (e.ParentNode != null)
                {
                    if (SortDescriptions.Any())
                    {
                        e.ParentNode.ChildNodes.Sort(SortDescriptions, SortComparers);
                    }
                }
                return;
            }

            if (e.ParentItem == null)
            {
                e.ChildItems = TreeGrid.ItemsSource as IEnumerable;
            }

            if (e.CanAddChildNode)
            {
                PopulateTreeNodes(e);
                if (this.SortDescriptions.Any())
                {
                    SortNodes(e.ParentNode);
                }
            }
        }
        internal override void RequestTreeItems(TreeGridRequestTreeItemsEventArgs e)
        {
            bool canPopualate = (e.ParentNode != null && e.ParentNode.ChildNodes.Any() && e.ResetChildAndRepopulate) || (e.ParentNode != null && !e.ParentNode.ChildNodes.Any()) || e.ParentNode == null;

            if (!canPopualate)
            {
                if (e.ParentNode != null)
                {
                    if (SortDescriptions.Any())
                    {
                        e.ParentNode.ChildNodes.Sort(SortDescriptions, SortComparers);
                    }
                }
                return;
            }

            if (e.ParentItem == null)
            {
                e.ChildItems = GetChildSourceFromParentID(SelfRelationRootValue, e.ParentItem, true);
            }
            else
            {
                object parentValue = propertyAccessProvider.GetValue(e.ParentItem, parentPropertyName);
                e.ChildItems = GetChildSourceFromParentID(parentValue, e.ParentItem, e.CanAddChildNode);
            }

            if (e.CanAddChildNode)
            {
                PopulateTreeNodes(e);
                if (this.SortDescriptions.Any())
                {
                    SortNodes(e.ParentNode);
                }
            }
        }
        internal override void RequestTreeItems(TreeGridRequestTreeItemsEventArgs e)
        {
            bool canPopualte = (e.ParentNode != null && e.ParentNode.ChildNodes.Any() && e.ResetChildAndRepopulate) || (e.ParentNode != null && !e.ParentNode.ChildNodes.Any()) || e.ParentNode == null;

            if (!canPopualte)
            {
                if (e.ParentNode != null && SortDescriptions.Any())
                {
                    e.ParentNode.ChildNodes.Sort(SortDescriptions, SortComparers);
                }
                return;
            }

            this.TreeGrid.RaiseRequestTreeItemsEvent(e);
            if (e.CanAddChildNode)
            {
                PopulateTreeNodes(e);
                if (e.ChildItems != null)
                {
                    WireNotifyPropertyChange(e.ChildItems);
                }
                if (this.SortDescriptions.Any())
                {
                    SortNodes(e.ParentNode);
                }
            }
        }
Exemple #4
0
        internal override void RequestTreeItems(TreeGridRequestTreeItemsEventArgs e)
        {
            bool canPopualate = (e.ParentNode != null && e.ParentNode.ChildNodes.Any() && e.ResetChildAndRepopulate) || (e.ParentNode != null && !e.ParentNode.ChildNodes.Any()) || e.ParentNode == null;

            if (!canPopualate)
            {
                if (e.ParentNode != null)
                {
                    if (SortDescriptions.Any())
                    {
                        e.ParentNode.ChildNodes.Sort(SortDescriptions, SortComparers);
                    }
                }
                return;
            }

            if (e.ParentItem == null)
            {
                e.ChildItems = TreeGrid.ItemsSource as IEnumerable;
            }
            else
            {
                if (!e.ParentNode.HasChildItems || e.ResetChildAndRepopulate)
                {
                    e.ChildItems = GetChildSource(e.ParentItem, childPropertyName);
                    if (e.ChildItems is INotifyCollectionChanged)
                    {
                        e.ParentNode.HasChildItems = true;
                    }
                }
                else
                {
                    e.ChildItems = (IEnumerable)e.ParentNode.ChildItems;
                }
            }

            if (e.ChildItems != null && e.ParentNode != null)
            {
                WireNotifyPropertyChange(e.ChildItems, e.ParentNode);
            }
            if (e.CanAddChildNode)
            {
                PopulateTreeNodes(e);
                if (this.SortDescriptions.Any())
                {
                    SortNodes(e.ParentNode);
                }
            }
        }