I'm trying to figure out how to use the Annotations extension in the code behind for WPF.
My scenario is that my user would right click on a chart to access a Context Menu option to "Add an Annotation" and I would respond to the event and add a new annotation at the users mouse location. I have been reviewing other forum posts and API Reference documentation from the Software FX Resource Center, but up to this point I can only get Annotations to work by directly putting them in the XAML - and then only if I use the Canvas properties to set the location. Setting the AttachX and AttachY in XAML does not work either. (At least from my experience).
I am using the ChartFx for WPF Trial Download for my testing.
Here is what I have put together in the code behind, but doesn't work...
Annotations annots = new Annotations();chart1.Extensions.Add(annots);Rectangle rectangle = new Rectangle();rectangle.Fill = Brushes.Red;rectangle.Stroke = Brushes.Black;Annotations.SetAttachX(rectangle, 2);Annotations.SetAttachY(rectangle, 5);Annotations.SetAttachHeight(rectangle, 2);Annotations.SetAttachWidth(rectangle, 4);annots.Children.Add(rectangle);
I am using the sample application (PassingData) as my test project. I updated the CLRObjectPage page with these changes in the code behind. No luck.
Any ideas?