wpf-devexpress-dot-xpf-dot-charts-dot-constantline-9c530ab3.md
Gets or sets a value that specifies whether a user can move the constant line.
Namespace : DevExpress.Xpf.Charts
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
public bool RuntimeMoving { get; set; }
Public Property RuntimeMoving As Boolean
| Type | Description |
|---|---|
| Boolean |
true, if the constant line can be moved; otherwise, false.
|
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;
}
}
Public Class TitleConverter
Inherits IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object
Dim res As Double
Double.TryParse(value.ToString(), res)
Return Math.Round(res, 3)
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object
Return value
End Function
End Class
See Also