Hi. I was trying to run example code about 'AnnotationsProvider' feature from here:
https://github.com/telerik/xaml-sdk/tree/master/ChartView/WPF/AnnotationsProvider
However, it seems to me that it doesn't working as was supposed. Neither 'AnnotationDescriptor' or 'AnnotationDescriptorSelector' user control are not working properly (I had not seen any annotations at all). Only 'AnnotationCreated' user control drew the annotations by using code-behind event handler. What am i doing wrong?
My current Telerik libraries version is 2017.2.503.4
3 Answers, 1 is accepted
I forgot to mention that I've made some modifications in project itself. I switched to the NoXaml dll's as well as explicitly included Theme library dll (Telerik.Windows.Themes.Office_Black) and merged the needed .xaml files inside my App.xaml file.
P.S. When I was running the code "as is" everething was working properly (see attached images)
Thank you for the provided information.
The annotations are not shown in NoXaml scenario because the descriptor Styles are not based on the default annotation styles. Basically, when you use custom style for any of the UI for WPF controls in a NoXaml scenario you will need to base it on the control's default style. Otherwise, the control won't be rendered. This is because the custom style completely overrides the default implicit style including the Template of the control.
To resolve the issue you can add the BasedOn attribute to all descriptor styles targeting the annotations. For example:
<
telerik:ChartAnnotationDescriptor.Style
>
<
Style
TargetType
=
"telerik:CartesianGridLineAnnotation"
BasedOn
=
"{StaticResource CartesianGridLineAnnotationStyle}"
>
<
Setter
Property
=
"Value"
Value
=
"{Binding StartValue}"
/>
<
Setter
Property
=
"Axis"
Value
=
"{Binding VerticalAxis, RelativeSource={RelativeSource AncestorType=telerik:RadCartesianChart}}"
/>
<
Setter
Property
=
"Stroke"
Value
=
"Red"
/>
<
Setter
Property
=
"StrokeThickness"
Value
=
"2"
/>
</
Style
>
</
telerik:ChartAnnotationDescriptor.Style
>
I hope this helps. If you need any further assistance please let me know.
Regards,
Martin Ivanov
Progress Telerik