I have a collection
private ObservableCollection<ContentItemViewModel> _contentTree;
public ObservableCollection<ContentItemViewModel> ContentTree
{
get { return _contentTree; }
}
class ContentItemViewModel has property:
private string _published;
public string Published
{
get
{
return _published;
}
set
{
_published = value;
NotifyPropertyChanged("Published");
}
}
that is – node.Published= Convert.ToDateTime(date.Value).ToString("dd MMM yyyy", new DateTimeFormatInfo());
I need to sort ContentTree collection by date? how can I do this?
I do not know if there is any better way but you can do the following. The idea here is to create an ordered list and first foreach item in the ordered list, removing and re-adding the related item from content tree.
Or you can employ Comparison;