private static void OnListViewHeaderClick(object sender, RoutedEventArgs e)
        {
            var listView = e.Source as TreeList;
            GridViewColumnHeader header   = e.OriginalSource as GridViewColumnHeader;
            SortInfo             sortInfo = listView.GetValue(SortInfoProperty.DependencyProperty) as SortInfo;

            if (sortInfo != null)
            {
                AdornerLayer.GetAdornerLayer(sortInfo.LastSortColumn).Remove(sortInfo.CurrentAdorner);
                listView.Items.SortDescriptions.Clear();
            }
            else
            {
                sortInfo = new SortInfo();
            }
            if (sortInfo.CurrentAdorner == null)
            {
                return;
            }
            if (sortInfo.LastSortColumn == header)
            {
                (sortInfo.CurrentAdorner.Child as SortDecorator).SortDirection = (sortInfo.CurrentAdorner.Child as SortDecorator).SortDirection == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
            }
            else
            {
                sortInfo.CurrentAdorner = new UIElementAdorner_Sort(header, new SortDecorator());
            }

            sortInfo.LastSortColumn = header;
            listView.SetValue(SortInfoProperty, sortInfo);

            AdornerLayer.GetAdornerLayer(header).Add(sortInfo.CurrentAdorner);
            SortDescription sortDescriptioin = new SortDescription()
            {
                Direction    = (sortInfo.CurrentAdorner.Child as SortDecorator).SortDirection,
                PropertyName = header.Column.GetValue(SortFieldProperty) as string ?? header.Column.Header as string
            };

            listView.Items.SortDescriptions.Add(sortDescriptioin);
        }
 internal static void SetSortInfo(DependencyObject obj, SortInfo value)
 {
     obj.SetValue(SortInfoProperty.DependencyProperty, value);
 }