I have a custom annotation class that I would like to bind the geometries.
<Path.Data>
</Path.Data>
public GeometryGroup Elements
{
get { return _elements; }
set
{
_elements = value;
InvokePropertyChanged("Elements");
}
}
When I create the class in code it only works if Path was set in xaml, doesn’t work if set in code.
Path p = new Path();
p.Data = Geometry.Parse("m 0 0 10 0 10 10 0 10 z");
GeometryGroup g = new GeometryGroup();
g.Children.Add(p.RenderedGeometry);
CustomPathAnnotation cpa = new CustomPathAnnotation()
{
Elements = g,
X1 = .55,
Y1 = .5,
CoordinateMode = AnnotationCoordinateMode.Relative,
XAxisId = "DefaultAxisId",
YAxisId = "DefaultAxisId",
Visibility = Visibility.Visible
};
ChartAnnotation.Add(cpa);
- Dan Gabbard asked 8 years ago
-
Hi Dan, I’m not sure why it doesn’t work, there shouldn’t be any diference between setting a property in XAML or in code. Could you post the full code of your custom annotation class here for us to take a look?
- You must login to post comments
Yuriy,
I got it to work using the following:
<Polygon x:Name="ptPolygon" Points="{Binding polyPoints}" Stretch="Fill" Fill="{Binding polyFill}" Stroke="{Binding polyStroke}" />
- Dan Gabbard answered 8 years ago
- You must login to post comments
Please login first to submit.