protected override Rect GetBoundingRectangleCore() { if (this.Series == null || this.Series.ChartArea == null || !this.Series.ChartArea.IsTemplateApplied) { return(base.GetBoundingRectangleCore()); } FrameworkElement dataPointView = SeriesVisualStatePresenter.GetDataPointView(this.DataPoint); if (dataPointView != null) { return(new FrameworkElementAutomationPeer(dataPointView).GetBoundingRectangle()); } AutomationPeer peerForElement = UIElementAutomationPeer.CreatePeerForElement((UIElement)this.Series); if (!(this.Series is LineSeries) || this.DataPoint.View == null || peerForElement == null) { return(base.GetBoundingRectangleCore()); } Point anchorPoint = this.DataPoint.View.AnchorPoint; Rect rectangle = RectExtensions.Expand(new Rect(anchorPoint.X, anchorPoint.Y, 0.0, 0.0), 2.0, 2.0); Rect boundingRectangle = peerForElement.GetBoundingRectangle(); Size renderSize = this.Series.SeriesPresenter.RootPanel.RenderSize; Size size = RectExtensions.GetSize(boundingRectangle); return(RectExtensions.Translate(RectExtensions.Transform(rectangle, (Transform) new ScaleTransform() { ScaleX = (size.Width / renderSize.Width), ScaleY = (size.Height / renderSize.Height) }), boundingRectangle.X, boundingRectangle.Y)); }
// Return bounding rectangle (screen coords) for this element... private object InContextBoundingRectangle(object unused) { AutomationPeer peer = Peer; if (peer == null) { throw new ElementNotAvailableException(); } return(peer.GetBoundingRectangle()); }
protected override Rect GetBoundingRectangleCore() { AutomationPeer peerForElement = UIElementAutomationPeer.CreatePeerForElement(this._adorner); if (peerForElement != null) { return(peerForElement.GetBoundingRectangle()); } return(base.GetBoundingRectangleCore()); }
protected override Rect GetBoundingRectangleCore() { AutomationPeer wrapperPeer = this.GetWrapperPeer(); if (wrapperPeer != null) { return(wrapperPeer.GetBoundingRectangle()); } return(new Rect()); }
public void AllTests() { DataGridColumnHeader fe = CreateConcreteFrameworkElement() as DataGridColumnHeader; AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(fe); // GetAutomationControlType Assert.AreEqual(AutomationControlType.HeaderItem, peer.GetAutomationControlType(), "GetAutomationControlType"); // GetBoundingRectangle Rect boundingRectangle = peer.GetBoundingRectangle(); Assert.AreNotEqual(0, boundingRectangle.X, "GetBoundingRectangle X"); Assert.AreNotEqual(0, boundingRectangle.Y, "GetBoundingRectangle Y"); Assert.AreNotEqual(0, boundingRectangle.Width, "GetBoundingRectangle Width"); Assert.AreNotEqual(0, boundingRectangle.Height, "GetBoundingRectangle Height"); // GetChildren List <AutomationPeer> children = peer.GetChildren(); Assert.IsNotNull(children, "#0"); Assert.AreEqual(1, children.Count, "#1"); // IsKeyboardFocusable Assert.IsFalse(peer.IsKeyboardFocusable(), "IsKeyboardFocusable"); // GetClassName Assert.AreEqual("DataGridColumnHeader", peer.GetClassName(), "#0"); // IsContentElement Assert.IsFalse(peer.IsContentElement(), "#0"); // GetName Assert.AreEqual(fe.Content, peer.GetName(), "GetName"); // GetClickablePoint Point p = peer.GetClickablePoint(); Assert.IsFalse(double.IsNaN(p.X), "#0"); Assert.IsFalse(double.IsNaN(p.Y), "#1"); // GetParent Assert.IsNotNull(peer.GetParent(), "GetParent"); // IsOffscreen Assert.IsFalse(peer.IsOffscreen(), "IsOffScreen"); }