private static void OnParentScaleXPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { ZoomElement thisLabel = (ZoomElement)source; if (thisLabel.ParentScaleX != 0) { double tempScale = (1.0 / thisLabel.ParentScaleX) * (thisLabel.Scale); thisLabel.SetScaleX(tempScale); } }
private static void OnScaleChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { ZoomElement thisLabel = (ZoomElement)source;//get this label if (Math.Abs((double)e.NewValue - (double)e.OldValue) < 0.00001) { return; } if (thisLabel.ParentScaleX != 0) { double tempScaleX = (1.0 / thisLabel.ParentScaleX) * (thisLabel.Scale); thisLabel.SetScaleX(tempScaleX); } if (thisLabel.ParentScaleY != 0) { double tempScaleY = (1.0 / thisLabel.ParentScaleY) * (thisLabel.Scale); thisLabel.SetScaleY(tempScaleY); } thisLabel.ReinitializePosition(null, null);//update the label position }