By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,419 Members | 1,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,419 IT Pros & Developers. It's quick & easy.

Re: Use MultiBinding to bind polyline point to a thumb

P: n/a
>I have a sample similar to a previous post where I was binding a line end
>to a thumb. now I'm trying to bind a polyline point to a thumb. in this
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.
Not sure if I'm right, but I think the problem is that the data binding
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
Jul 3 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.