ConstantLine.RuntimeMoving Property
Gets or sets a value that specifies whether a user can move the constant line.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v24.1.dll
NuGet Package: DevExpress.Wpf.Charts
Declaration
Property Value
Type | Description |
---|---|
Boolean | true, if the constant line can be moved; otherwise, false. |
Remarks
The following example shows how to add a constant line that a user can move at runtime. Once a user moves the constant line, the constant line’s title is updated to display the current constant line value.
<Window.Resources>
<local:TitleConverter x:Key="titleConverter"/>
</Window.Resources>
<Grid>
<dxc:ChartControl x:Name="chart" CrosshairEnabled="False">
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.AxisY>
<dxc:AxisY2D>
<dxc:AxisY2D.WholeRange>
<dxc:Range dxc:AxisY2D.AlwaysShowZeroLevel="False"/>
</dxc:AxisY2D.WholeRange>
<dxc:AxisY2D.ConstantLinesInFront>
<dxc:ConstantLine x:Name="cl" Value="25" RuntimeMoving="True">
<dxc:ConstantLine.Title>
<dxc:ConstantLineTitle Content="{Binding ElementName=cl, Path=Value, Converter={StaticResource titleConverter}}"/>
</dxc:ConstantLine.Title>
</dxc:ConstantLine>
</dxc:AxisY2D.ConstantLinesInFront>
</dxc:AxisY2D>
</dxc:XYDiagram2D.AxisY>
</dxc:XYDiagram2D>
</dxc:ChartControl>
</Grid>
public class TitleConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
double res;
double.TryParse(value.ToString(), out res);
return Math.Round(res, 3);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
return value;
}
}
See Also