I would like to have my collection shown sorted when this class is presented in the PropertyGrid.
As this stands now, I simply get the name of the class "CollectionView" shown in the editor.
private ObservableCollection<MultiCueAddLogicalCommand> _Cues = new ObservableCollection<MultiCueAddLogicalCommand>();
[Browsable(false)]
public ObservableCollection<MultiCueAddLogicalCommand> Cues
{
get { return _Cues; }
set
{
if(_Cues == value)
return;
_Cues = value;
RaisePropertyChanged(() => Cues);
}
}
private CollectionView _SortedCues;
[DisplayName("Cues")]
[Category("Default")]
[Description("Cues in this MultiCue")]
[TypeConverter(typeof(ExpandableCollectionConverter))]
public CollectionView SortedCues
{
get { return _SortedCues; }
set
{
if(_SortedCues == value)
return;
_SortedCues = value;
RaisePropertyChanged(() => SortedCues);
}
}
// constructor
public CreateMultiCueCommand()
{
SortedCues = (CollectionView)CollectionViewSource.GetDefaultView(Cues);
SortedCues.SortDescriptions.Add(new SortDescription("TimingOffset", ListSortDirection.Ascending ));
}
What do I need to do to have the sorted list shown?
Thanks