BindingList<T>.ApplySortCore 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
如果在衍生類別中覆寫時,排序項目,否則擲回 NotSupportedException。
protected:
virtual void ApplySortCore(System::ComponentModel::PropertyDescriptor ^ prop, System::ComponentModel::ListSortDirection direction);
protected virtual void ApplySortCore (System.ComponentModel.PropertyDescriptor prop, System.ComponentModel.ListSortDirection direction);
abstract member ApplySortCore : System.ComponentModel.PropertyDescriptor * System.ComponentModel.ListSortDirection -> unit
override this.ApplySortCore : System.ComponentModel.PropertyDescriptor * System.ComponentModel.ListSortDirection -> unit
Protected Overridable Sub ApplySortCore (prop As PropertyDescriptor, direction As ListSortDirection)
參數
- prop
- PropertyDescriptor
PropertyDescriptor,指定要排序的屬性。
- direction
- ListSortDirection
其中一個 ListSortDirection 值。
例外狀況
在衍生類別中未覆寫方法。
備註
類別 BindingList<T> 不提供排序的基底實作,因此 ApplySortCore 一律預設會擲回 NotSupportedException 。 若要啟用排序,請衍生自 BindingList<T> 並執行下列工作:
覆寫 ApplySortCore 並實作排序,並在排序完成時引發 ListChanged 事件。
覆寫 RemoveSortCore 並實作排序移除。
覆寫 SupportsSortingCore 並設定 SupportsSortingCore 為
true
。
此外,您可能想要實作補充 SortDirectionCore 和 SortPropertyCore 排序屬性。