在树视图中对节点进行排序

时间:2013-06-17 11:53:39

标签: silverlight silverlight-4.0 silverlight-5.0

我有以下课程

public class TreeViewNode : NotificationObject
{
  public TreeViewNode()
  {
    Children = new ObservableCollection<TreeViewNode >();
  }
    private string _name;
    public string Name
    {
        get { return _name; }
        set
        {
            if (_name == value) return;
            _name = value;
            RaisePropertyChanged(() => Name);
        }
    }

    private ObservableCollection<FolderJobTreeViewNode> _children;
    public ObservableCollection<FolderJobTreeViewNode> Children
    {
        get { return _children; }
        set
        {

            if (_children == value) return;
              _children = value;
            RaisePropertyChanged(() => Children);
        }
    }

    private TreeViewNode _parent;
    public TreeViewNode Parent
    {
        get { return _parent; }
        set
        {
            if (_parent == value) return;
            _parent = value;
            RaisePropertyChanged(() => Parent);
        }
    }

}

在XAML文件中,我将TreeView ItemSource绑定到TreeViewNode

的集合
<TreeView Grid.Row="0"
                  x:Name="FoldersAndJobsTree"
                  ItemsSource="{Binding TreeViewNodeCollection}"/>

我的要求是对包括子节点在内的所有节点进行排序。 我成功地只对根进行排序..我想在树中显示节点之前对集合进行排序,但这不是我想要的

由于

0 个答案:

没有答案