private static void OnAnimationTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { LayoutManager mgr = (LayoutManager)d; mgr.AnimationDuration = new Duration(new TimeSpan(0, 0, 0, 0, mgr.AnimationTime)); }
private void ObservedPanel_PartBoundsChanged(object sender, EventArgs e) { Diagram observed = this.Observed; if (observed == null) { return; } // don't let animated movements mess up data via TwoWay data-bindings LayoutManager observedlayout = observed.LayoutManager; if (observedlayout != null && observedlayout.IsAnimating) { return; } PartManager partmgr = this.PartManager; if (partmgr == null) { return; } Node observednode = sender as Node; if (observednode != null && this.UsesObservedNodeLocation) { // find the corresponding node in this Overview Node overviewnode = partmgr.FindNodeForData(observednode.Data, observed.Model); if (overviewnode != null) { // need to remove any Binding for Node.Location on this node, // in case it is Mode=TwoWay, trying to update the data FrameworkElement ve = overviewnode.EnsuredVisualElement; if (ve != null) { //var be0 = ve.GetBindingExpression(Node.LocationProperty); ve.ClearValue(Node.LocationProperty); //var be1 = ve.GetBindingExpression(Node.LocationProperty); //var locval = ve.ReadLocalValue(Node.LocationProperty); //var val = ve.GetValue(Node.LocationProperty); } // the observed node has moved -- also move this overview's node Point ovloc = overviewnode.Location; Point obloc = observednode.Location; if (!Geo.IsApprox(ovloc, obloc)) { overviewnode.Location = obloc; } } } else { Link observedlink = sender as Link; if (observedlink != null && this.UsesObservedLinkRoute) { Link overviewlink = partmgr.FindLinkForData(observedlink.Data, observed.Model); if (overviewlink != null) { // the observed link has moved or changed size -- replace this overview's link's route // with that of the observed link's, so it doesn't need to be recomputed //??? doesn't handle case where the points have changed, but the Bounds haven't overviewlink.Route.Points = observedlink.Route.Points; } } } }