private static void Segments_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e) { PathFigure figure = (PathFigure)d; PathSegmentCollection oldCollection = (PathSegmentCollection)e.OldValue; PathSegmentCollection newCollection = (PathSegmentCollection)e.NewValue; if (oldCollection != null) { oldCollection.SetParentPath(null); } if (figure.INTERNAL_parentPath != null && figure.INTERNAL_parentPath._isLoaded) { if (newCollection != null) { newCollection.SetParentPath(figure.INTERNAL_parentPath); } figure.INTERNAL_parentPath.ScheduleRedraw(); } }