/// <summary> /// When overridden in a derived class, is invoked whenever application code or /// internal processes (such as a rebuilding layout pass) call /// <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>. /// </summary> public override void OnApplyTemplate() { compass = this; CompassScale = GetTemplateChild("CompassScale") as ScaleTransform; CompassFace = GetTemplateChild("compassFace") as Ellipse; if (scale != 1) { compass.CompassScale.ScaleX = scale; compass.CompassScale.ScaleY = scale; } if (expandOnMouseOver) { compass.MouseEnter += new MouseEventHandler(compass_MouseEnter); compass.MouseLeave += new MouseEventHandler(compass_MouseLeave); } if (faceFill != null) CompassFace.Fill = faceFill; }