我有以下课程
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}"/>
我的要求是对包括子节点在内的所有节点进行排序。我成功地对根进行了排序..我认为在树中显示节点之前对集合进行排序,但这不是我要找的
谢谢