Hi there,
In the application we are developing, a user has the ability to add his/her own text annotation to the chart. Its simply done on the code behind, as its not persisted, so its really simple.
The code we use to add the user text annotation is:
private void AddTextAnnotationExecute(object obj)
{
var yValue = YAxis.HitTest(MousePoint);
var xValue = XAxis.HitTest(MousePoint);
var textAnnotation = new TextAnnotation
{
CanEditText = true,
IsEditable = true,
IsEnabled = true,
Text = xValue.DataValue.ToString(),
X1 = xValue.DataValue,
Y1 = yValue.DataValue,
YAxisId = YAxis.Id,
Uid = Guid.NewGuid().ToString(),
};
_sciChartSurface.Annotations.Add(textAnnotation);
foreach (var annotation in _sciChartSurface.Annotations.Cast<AnnotationBase>().Where(c => !string.IsNullOrEmpty(c.Uid)))
{
annotation.IsEditable = true;
}
_customAnnotationCollectionList.Add(textAnnotation);
}
This is the style we apply to the text annotation:
<Style TargetType="sciChart:TextAnnotation">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="AnnotationCanvas" Value="AboveChart"/>
</Style>
So as you can see its pretty straight forward, but this is where is gets weird, this functionality works perfectly on computers on which Visual Studio is installed on, but on other computers, the text annotation is selectable and moveable, but no amount of double clicking enables the annotation for editing. I tried forcing the textbox IsEnabled=”True”, but to no avail.
Any suggestions?
Thanks in advance
- Charl Rhyn asked 8 years ago
- You must login to post comments
Hi Chuck,
Have you also set TextAnnotation.CanEditText?
If you need to send over a full code sample so we can investigate, please email it to support.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 8 years ago
- You must login to post comments
Please login first to submit.