In This Article

DataModelBase Class

Provides an abstract base class for a property grid IDataModel.

public abstract class DataModelBase : ObservableObjectBase, IDataModel, IDisposable
Inheritance:
object ObservableObjectBase object
Derived:
CategoryEditorModel CategoryModel PropertyModelBase
Implements:
IDataModel IDisposable

Constructors

DataModelBase()

Initializes an instance of the class.

protected DataModelBase()

Properties

CanAutoDispose

Indicates whether the data model should be automatically disposed when it is removed from a parent data model.

public virtual bool CanAutoDispose { get; }

Property Value

bool:

true if the data model should be automatically disposed when it is removed from a parent data model; otherwise, false.

Children

The collection of child data models.

public DataModelCollection Children { get; }

Property Value

DataModelCollection

DescriptionResolved

The resolved description of the data model, often displayed in a summary area or a tooltip.

protected abstract string? DescriptionResolved { get; }

Property Value

string

DisplayNameResolved

The name to use when displaying the data model, often the same as Name.

protected abstract string? DisplayNameResolved { get; }

Property Value

string

IsExpanded

Indicates whether the data model is expanded.

public bool IsExpanded { get; set; }

Property Value

bool:

true if the data model is expanded; otherwise, false.

IsModifiedResolved

Indicates whether the data model has been modified.

protected abstract bool IsModifiedResolved { get; }

Property Value

bool:

true if the data model has been modified; otherwise, false.

IsRoot

Indicates whether the data model is the root.

public virtual bool IsRoot { get; }

Property Value

bool:

true if the data model is the root; otherwise, false.

IsSelected

Indicates whether the data model is selected.

public bool IsSelected { get; set; }

Property Value

bool:

true if the data model is selected; otherwise, false.

NameResolved

The resolved name of the data model.

protected abstract string? NameResolved { get; }

Property Value

string

Parent

The parent data model.

public IDataModel? Parent { get; }

Property Value

IDataModel

SortComparer

The DataModelSortComparer to use for sorting this data model's children.

public DataModelSortComparer? SortComparer { get; set; }

Property Value

DataModelSortComparer

Remarks

If this property doesn't return anything, the default SortComparer will be used.

SortImportanceResolved

A resolved DataModelSortImportance that indicates the sort importance of this data model.

protected abstract DataModelSortImportance SortImportanceResolved { get; }

Property Value

DataModelSortImportance

SortOrderResolved

A resolved numeric sort order for sorting the data model within other data models of the same sort importance.

protected abstract int SortOrderResolved { get; }

Property Value

int

Tag

Custom data for the data model.

public object? Tag { get; set; }

Property Value

object

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the object and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)
Parameter Type Description
disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method is called by the public Dispose method and the Finalize method. Dispose invokes this method with the disposing parameter set to true. Finalize invokes this method with disposing set to false.

~DataModelBase()

Allows an object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.

protected ~DataModelBase()

RefreshChildren()

Refreshes the contents of the Children property.

protected virtual void RefreshChildren()

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Inherited Members

Extension Methods