Skip to main content

Parameter.DefaultValue Property

Specifies the initial value of the parameter.

Namespace: DevExpress.Diagram.Core.Shapes

Assembly: DevExpress.Diagram.v24.1.Core.dll

NuGet Package: DevExpress.Diagram.Core

Declaration

public double DefaultValue { get; set; }

Property Value

Type Description
Double

A numerical value that is the initial value of the parameter.

Remarks

Each parameter is characterized by its Parameter.Value property. The DefaultValue property returns the initial value.

To pass the current Parameter.Point to the Parameter.Value definition, use the P.X and P.Y variables that correspond to the point’s X and Y coordinates.

Value="P.Y / H" 

The code snippet below illustrates how to define a parameter that changes its value from 0 to 1 depending on its current Y coordinate. An end-user cannot change the X coordinate.

<Parameter DefaultValue="0" 
                       Point="CreatePoint(W / 2, P * H)" 
                       Value="P.Y / H" 
                       Min="0" Max="1" />

You can pass the parameter’s value to the CreateSize method. The P0 variable corresponds to the first parameter within the ShapeTemplate.Parameters collection, the P1 corresponds to the second parameter and so on. The code snippet below illustrates how to use this parameter to allow an end-user to transform the shape by changing the Arc segment’s size.

<ShapeTemplate x:Key="{ShapeKey CustomizableArc}" DefaultSize="60, 120">
        <Start X="0" Y="0" FillColor="Green"/>
        <Arc X="1" Y="0" Size="CreateSize(W/2, P0 * H)" Direction="Counterclockwise" />
        <Line X="1" Y="1"/>
        <Line X="0" Y="1"/>
        <Line X="0" Y="0"/>
        <ShapeTemplate.Parameters>
            <Parameter DefaultValue="0" 
                       Point="CreatePoint(W / 2, P * H)" 
                       Value="P.Y / H" 
                       Min="0" Max="1" />
        </ShapeTemplate.Parameters>
    </ShapeTemplate>

The following image shows the result:

shape_transform_parameter

The following code snippets (auto-collected from DevExpress Examples) contain references to the DefaultValue property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also