Closed
Hello,
I have this
private readonly string CHART_MARKER_TEXT = "Marker";
private readonly string CHART_MARKER_STYLE = "VerticalLineAnnotationStyle"; // defined in Chart.xaml
AddVerticalLineAnnotation(new AnnotationRequest() { XValue = 3, LabelText = CHART_MARKER_TEXT, AnnotationStyle = CHART_MARKER_STYLE });
private void AddVerticalLineAnnotation(AnnotationRequest request)
{
Annotations.Add(new VerticalLineAnnotationViewModel
{
X1 = request.XValue,
LabelValue = !string.IsNullOrEmpty(request.LabelText) ? request.LabelText : null,
VerticalAlignment = VerticalAlignment.Stretch,
LabelPlacement = LabelPlacement.Left,
LabelsOrientation = System.Windows.Controls.Orientation.Vertical,
StyleKey = request.AnnotationStyle,
});
}
And this
<Style x:Key="VerticalLineAnnotationStyle" TargetType="{x:Type s:VerticalLineAnnotation}">
<Setter Property="Stroke" Value="Orange" />
<Setter Property="StrokeThickness" Value="2" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
Why I can’t see Label?
- Fedor Iudin asked 7 months ago
- last edited 7 months ago
-
Hm… Label not shown by default. This if solution: Setter Property=”ShowLabel” Value=”True”
-
Hi Fedor, thanks for the well formed question & answer. You are right, the answer is indeed set VerticalLineAnnotation.ShowLabel = true. This should be both on the VerticalLineAnnotation as well as the VerticalLineAnnotationViewModel for MVVM. Thanks!
-
And what the difference between VerticalLineAnnotation and VerticalLineAnnotationForMvvm?
- You must login to post comments