Partager via


Constraint Class

Constraint.When the object is serialized out as xml, its qualified name is dgm:constr.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Drawing.Diagrams.Constraint

Namespace:  DocumentFormat.OpenXml.Drawing.Diagrams
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(ExtensionList))> _
Public Class Constraint _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Constraint
[ChildElementInfoAttribute(typeof(ExtensionList))]
public class Constraint : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • ExtensionList <dgm:extLst>

[ISO/IEC 29500-1 1st Edition]

21.4.2.8 constr (Constraint)

This element is used to specify size, position of nodes, text values, and layout dependencies between nodes in a layout definition.

[Example: Consider the following example of a constraint list which contains some example constraints being defined and applied to layout nodes in the layout definition:

<constrLst>
<constr type="w" for="ch" forName="node1" refType="w" refForName=""/>
<constr type="h" for="ch" forName="node1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.6"/>
<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>
<constr type="primFontSz" for="ch" forName="node1" refForName="" op="equ" val="100"/>
</constrLst>

In this example we can see constraints being defined for the width and height along with the primary font size for a layout node referenced by node1. The width for a transition is also specified. end example]

Parent Elements

constrLst (§21.4.2.9)

Child Elements

Subclause

extLst (Extension List)

§21.4.2.13

Attributes

Description

fact (Factor)

Factor used in a reference constraint or a rule in order to modify a referenced value by the factor defined.

[Example: Consider the following example of fact in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, the width for transition1 is being defined as one-tenth the width of node1. end example]

The possible values for this attribute are defined by the W3C XML Schema double datatype.

for (For)

Specifies the axis of layout nodes to apply a constraint or rule to.

[Example: Consider the following example of for in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, the for attribute is specifying that node1 is a child node to the current layout node. end example]

The possible values for this attribute are defined by the ST_ConstraintRelationship simple type (§21.4.7.20).

forName (For Name)

Specifies the name of the layout node to apply a constraint or rule to.

[Example: Consider the following example of forName in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, forName is specifying the layout node named transition1 for its reference. end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

op (Operator)

The operator constraint used to evaluate the condition.

[Example: Consider the following example of op in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, op is specifying an equality defined between the two referencing values. end example]

The possible values for this attribute are defined by the ST_BoolOperator simple type (§21.4.7.10).

ptType (Data Point Type)

Specifies the type of data point to select.

The possible values for this attribute are defined by the ST_ElementType simple type (§21.4.7.27).

refFor (Reference For)

The for value of the referenced constraint.

[Example: Consider the following example of refFor in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, refFor is specifying the reference constraint is a child of the current layout node. end example]

The possible values for this attribute are defined by the ST_ConstraintRelationship simple type (§21.4.7.20).

refForName (Reference For Name)

The name of the layout node referenced by a reference constraint.

[Example: Consider the following example of refForName in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, refForName is specifying the layout node named node1 for its reference. end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

refPtType (Reference Point Type)

The point type used int he referenced constraint.

The possible values for this attribute are defined by the ST_ElementType simple type (§21.4.7.27).

refType (Reference Type)

Specifies the type of a reference constraint.

[Example: Consider the following example of refType in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, refType is specifying referencing the width attribute of node1. end example]

The possible values for this attribute are defined by the ST_ConstraintType simple type (§21.4.7.21).

type (Constraint Type)

Specifies the constraint to apply to this layout node.

[Example: Consider the following example of type in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" refType="w" refFor="ch" refForName="node1" op="equ" fact="0.1"/>

In this example, type is specifying the width attribute of transition1. end example]

The possible values for this attribute are defined by the ST_ConstraintType simple type (§21.4.7.21).

val (Value)

Specifies an absolute value instead of reference another constraint.

[Example: Consider the following example of forName in use in a DrawingML diagram:

<constr type="w" for="ch" forName="transition1" val="10"/>

In this example, val is specifying the absolute value of the width of transition1. end example]

The possible values for this attribute are defined by the W3C XML Schema double datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_Constraint) is located in §A.5.3. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Constraint Members

DocumentFormat.OpenXml.Drawing.Diagrams Namespace