private void OnMove(bool up)
        {
            List <Domain.Attribute> attributes = GetSelectedValues();

            if (attributes.Count == 0)
            {
                return;
            }
            if (up)
            {
                attributes.BubbleSort();
            }
            else
            {
                attributes.BubbleSortDesc();
            }
            foreach (Domain.Attribute attribute in attributes)
            {
                Domain.Attribute parent = attribute.parent;
                if (parent == null)
                {
                    parent = this.Root;
                }

                ForgetDefaultAttributes(parent);
                int position           = attribute.position + (up ? -1 : 1);
                Domain.Attribute child = (Domain.Attribute)parent.GetChildByPosition(position);
                if (child != null)
                {
                    child.SetPosition(attribute.position);
                    parent.UpdateChild(child);
                    attribute.SetPosition(position);
                    parent.UpdateChild(attribute);

                    int row = Source.IndexOf(child);
                    Source.Remove(attribute);
                    Source.Insert(row, attribute);
                }
                AddDefaultAttributes(parent);
            }
            treeList.SelectedItems = attributes;
            if (Changed != null)
            {
                Changed();
            }
        }
        private void OnIndentClick(object sender, RoutedEventArgs e)
        {
            List <Domain.Attribute> attributes = GetSelectedValues();

            if (attributes.Count == 0)
            {
                return;
            }
            attributes.BubbleSort();
            foreach (Domain.Attribute attribute in attributes)
            {
                Domain.Attribute parent = attribute.parent;
                if (parent == null)
                {
                    parent = this.Root;
                }
                int position             = attribute.GetPosition();
                Domain.Attribute brother = (Domain.Attribute)parent.GetChildByPosition(position - 1);
                if (brother == null)
                {
                    return;
                }
                ForgetDefaultAttributes(parent);
                parent.ForgetChild(attribute);
                brother.AddChild(attribute);
                brother.related    = true;
                brother.IsExpanded = true;

                int row = Source.IndexOf(brother);
                Source.Remove(brother);
                Source.Insert(row, brother);
                AddDefaultAttributes(parent);
            }
            treeList.RefreshData();
            treeList.SelectedItems = attributes;
            if (Changed != null)
            {
                Changed();
            }
        }