private void BindToDiagram(Diagram diagram) { if (diagram == null) { this.Model = null; return; } if (diagram.Model is PartsModel) { Diagram.Error("cannot show an Overview of a Diagram with a PartsModel"); return; } ApplyTemplate(); DiagramPanel vpanel = this.Panel; if (vpanel == null) { return; } //vpanel.IsVirtualizing = false; diagram.ApplyTemplate(); DiagramPanel dpanel = diagram.Panel; if (dpanel == null) { return; } if (!this.BoundEventHandlers) { // try to avoid executing this twice this.BoundEventHandlers = true; dpanel.ViewportBoundsChanged += this.ObservedPanel_ViewportBoundsChanged; dpanel.DiagramBoundsChanged += this.ObservedPanel_DiagramBoundsChanged; dpanel.PartBoundsChanged += this.ObservedPanel_PartBoundsChanged; dpanel.PartVisibleChanged += this.ObservedPanel_PartVisibleChanged; diagram.TemplatesChanged += this.ObservedDiagram_TemplatesChanged; diagram.ModelReplaced += this.ObservedDiagram_ModelReplaced; vpanel.ViewportBoundsChanged += this.OverviewPanel_ViewportBoundsChanged; } UpdateModel(); UpdateTemplates(); BindBox(); }
private void BindToDiagram(Diagram diagram) { if (diagram == null) { this.Model = null; return; } if (diagram.Model is PartsModel) { Diagram.Error("cannot show an Overview of a Diagram with a PartsModel"); return; } ApplyTemplate(); DiagramPanel vpanel = this.Panel; if (vpanel == null) return; //vpanel.IsVirtualizing = false; diagram.ApplyTemplate(); DiagramPanel dpanel = diagram.Panel; if (dpanel == null) return; if (!this.BoundEventHandlers) { // try to avoid executing this twice this.BoundEventHandlers = true; dpanel.ViewportBoundsChanged += this.ObservedPanel_ViewportBoundsChanged; dpanel.DiagramBoundsChanged += this.ObservedPanel_DiagramBoundsChanged; dpanel.PartBoundsChanged += this.ObservedPanel_PartBoundsChanged; dpanel.PartVisibleChanged += this.ObservedPanel_PartVisibleChanged; diagram.TemplatesChanged += this.ObservedDiagram_TemplatesChanged; diagram.ModelReplaced += this.ObservedDiagram_ModelReplaced; vpanel.ViewportBoundsChanged += this.OverviewPanel_ViewportBoundsChanged; } UpdateModel(); UpdateTemplates(); BindBox(); }