>to a thumb. now I'm trying to bind a polyline point to a thumb. in thisNot sure if I'm right, but I think the problem is that the data binding
case its the first point, but later it could be any point which I will want
to do. In this sample I'm not getting errors, but the binding doesn't seem
to be doing anything. In the custom polyline class I created a new dp
property called FirstPoint which is Points[0] of the polyline's point
collection and I bound this dp to the center of the thumb. It seems like
it should be working, but doesnt. Can anyone explain why? I attached a
very simple and small project demonstraighting this.
doesn't go through the property wrapper, but just calls SetValue directly -
so you're never actually changing Points[0]. The solution is to use a
PropertyChangedCallback:
public static readonly DependencyProperty FirstPointProperty =
DependencyProperty.Register("FirstPoint",
typeof(Point), typeof(ArrowPolyline),
new FrameworkPropertyMetadata(new Point(),
FrameworkPropertyMetadataOptions.AffectsMeasure,
MyCallback));
public static void MyCallback(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
ArrowPolyline ap = (ArrowPolyline)d;
ap.Points[0] = (Point)e.NewValue;
}
Chris Jobson