CollectionView as a property

Grids for WPF Forum

Posted 9 years ago by Neil Larson
Version: 15.1.0623

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>();
public ObservableCollection<MultiCueAddLogicalCommand> Cues
   get { return _Cues; }
      if(_Cues == value)

      _Cues = value;
      RaisePropertyChanged(() => Cues);

private CollectionView _SortedCues;
[Description("Cues in this MultiCue")]
public CollectionView SortedCues
   get { return _SortedCues; }
      if(_SortedCues == value)

     _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?



Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Neil,

I'm sorry but CollectionView isn't supported.  The collection editing features only support objects that implement ICollection, IList, IDictionary, or any of their generic variations.  When we debug through the TypeDescriptorFactory class of ours, the native .NET TypeDescriptor doesn't return that the CollectionView type supports sub-properties (as it does for the collection types mentioned above).  That's why it's not expandable.  Thus, while your Cues property would work, the SortedCues would not.

The only workaround would be to build your own data factory and manually add child property items for each item in that CollectionView-based property.

Actipro Software Support

The latest build of this product (v24.1.2) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.