Table of Contents

Class DimensionStyleList

Namespace
CADability.Attribute
Assembly
CADability.dll

The DimensionStyleList contains the list of available dimension styles (DimensionStyle). It is owned by the project or the global settings. It implements IShowProperty to make it available in the tree voew of the control center.

public class DimensionStyleList : IShowPropertyImpl, IShowProperty, IPropertyEntry, ISerializable, ICommandHandler, IAttributeList, IDeserializationCallback
Inheritance
DimensionStyleList
Implements
Inherited Members

Constructors

DimensionStyleList()

Creates an empty list that belongs to no project or settings (Owner is null). Applications normally do not create lists themselves but use DimensionStyleList or DimensionStyleList of GlobalSettings.

public DimensionStyleList()

DimensionStyleList(SerializationInfo, StreamingContext)

Constructor required by deserialization

protected DimensionStyleList(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

SerializationInfo

context StreamingContext

StreamingContext

Properties

ContextMenu

Implementation of ContextMenu: the default returns null. An entry whose LabelType contains ContextMenu must override it.

public override MenuWithHandler[] ContextMenu { get; }

Property Value

MenuWithHandler[]

Count

The number of dimension styles in the list.

public int Count { get; }

Property Value

int

Current

The dimension style used for newly created dimensions: the Project assigns it to a Dimension that is added without a style, and the property grid shows it in bold. When no current style has been set, the first entry is returned; null for an empty list. Setting it does not raise DidModifyEvent.

public DimensionStyle Current { get; set; }

Property Value

DimensionStyle

EntryType

Overrides EntryType, returns GroupTitle.

public override ShowPropertyEntryType EntryType { get; }

Property Value

ShowPropertyEntryType

this[int]

Returns the dimension style at the given position. The entries are kept in alphabetical order of their names, so the index of a style changes when styles are added, removed or renamed.

public DimensionStyle this[int Index] { get; }

Parameters

Index int

Position in the list, from 0 to Count - 1

Property Value

DimensionStyle

The dimension style at that position

Exceptions

ArgumentOutOfRangeException

When Index is outside the list

LabelType

How the label of this entry behaves (see ShowPropertyLabelFlags): whether it can be selected or edited, is bold or has a context menu. The default implementation returns Selectable.

public override ShowPropertyLabelFlags LabelType { get; }

Property Value

ShowPropertyLabelFlags

Owner

The Project or Settings this list belongs to, null for a standalone list. The owner provides the ColorList, LineWidthList and other attribute lists the styles refer to, is asked before a style is removed (it refuses to remove the last style and asks the user when the style is still in use) and is informed about changes to the styles.

public IAttributeListContainer Owner { get; set; }

Property Value

IAttributeListContainer

SubEntries

The sub entries shown below this entry when it is opened in the property page. The default implementation has none and returns an empty array.

public override IShowProperty[] SubEntries { get; }

Property Value

IShowProperty[]

SubEntriesCount

The number of SubEntries, 0 for an entry that cannot be opened. The default implementation returns 0.

public override int SubEntriesCount { get; }

Property Value

int

Methods

Add(DimensionStyle)

Add a dimensionstyle to the list. If there is already a dimension styl with the same name in the list, the NameAlreadyExistsException will be thrown.

public void Add(DimensionStyle ToAdd)

Parameters

ToAdd DimensionStyle

dimension style to add

Find(string)

public DimensionStyle Find(string Name)

Parameters

Name string

Returns

DimensionStyle

GetObjectData(SerializationInfo, StreamingContext)

Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.

public void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

receives the data

context StreamingContext

the destination of the serialization

Remove(DimensionStyle)

The dimensionstyle ToRemove will be removed from the list. If there is no such dimension style, nothing will be changed.

public void Remove(DimensionStyle ToRemove)

Parameters

ToRemove DimensionStyle

Events

DidModifyEvent

Raised when a style has been added to the list (Add(DimensionStyle)) or after a call to Remove(DimensionStyle), also when nothing was removed. The handler gets this list as sender and null as arguments. Changes to the properties of a single style are reported through PropertyChangedEvent instead.

public event DidModifyDelegate DidModifyEvent

Event Type

DidModifyDelegate