private void ItemMouseEnter(object sender, MouseEventArgs e) { var item = sender as FrameworkElement; _adorner = new HighlightAdorner(item); AdornerLayer.GetAdornerLayer(item).Add(_adorner); }
/// <summary> /// New instance /// </summary> /// <param name="handler">Handler for this highlight adorner.</param> /// <param name="bodyHighlight">The corresponding highlight adorner in the body of the text.</param> public ScrollBarHighlightAdorner(ScrollBarHighlightHandler handler, HighlightAdorner bodyHighlight) : base(handler.ScrollViewer) { this.bodyHighlight = bodyHighlight; this.handler = handler; IsHitTestVisible = false; }
public ViewNode(ViewableDataObject UserData) { if (UserData == null) { throw new ArgumentNullException("UserData"); } this.UserData = UserData; SelectionAdorner = new HighlightAdorner(this); }
public void SetHighlightAdorner(HighlightAdorner value) { if (highlightAdorner != null) { canvas.Children.Remove(highlightAdorner.Visual); } highlightAdorner = value; if (highlightAdorner != null) { canvas.Children.Add(highlightAdorner.Visual); } }
public void Click() { Execute(() => { if (GingerAutomator.Highlight) { HighlightAdorner highlightAdorner = new HighlightAdorner(mButton); DoEvents(); SleepWithDoEvents(100); Speach.Say("Click Button " + mButton.Content.ToString()); Thread.Sleep(500); } mButton.RaiseEvent(new System.Windows.RoutedEventArgs(Button.ClickEvent)); }); }
/// <summary> /// Creates an adorner of type ScrollBarHighlightAdorner. /// </summary> /// <param name="highlightAdorner"></param> /// <returns></returns> public ScrollBarHighlightAdorner CreateScrollBarHighlightAdorner(HighlightAdorner highlightAdorner) { if (!IsUsable) return null; else return new ScrollBarHighlightAdorner(this, highlightAdorner); }
/// <summary> /// Gets the position of <c>bodyHighlight</c>. /// </summary> public Rect GetAdornerPosition(HighlightAdorner bodyHighlight) { double y = bodyHighlight.Y + (scrollViewerIsChild ? scrollViewer.VerticalOffset : 0); return new Rect(scrollViewer.ActualWidth - track.ActualWidth, scrollButtonSize + ((y / scrollViewer.ExtentHeight) * track.ActualHeight), track.ActualWidth, 3); }
/// <summary> /// Whether the Y coordinate in the argument is visible in the scroll viewer's viewport. /// </summary> public bool IsHighlightInViewPort(HighlightAdorner bodyHighlight) { if (scrollViewerIsChild) return bodyHighlight.IsInViewport; else return bodyHighlight.Y >= scrollViewer.ContentVerticalOffset && bodyHighlight.Y <= scrollViewer.ContentVerticalOffset + scrollViewer.ViewportHeight; }
/// <summary> /// Overrides should call RegisterHighlight to ensure proper registration of the Highlight. /// </summary> public virtual void AddHighlight(Run run, int index, int length) { HighlightAdorner adorner = new HighlightAdorner(uiElementToHighlight, run, index, length, scrollBarHighlightHandler.HorizontalScrollBarHeight, BodyHighlightAdornerBrush, BodyHighlightAdornerPen, BodyIterativeHighlightAdornerBrush, BodyIterativeHighlightAdornerPen); RegisterHighlight(new Highlight(index, index + length, adorner, run)); }
/// <summary> /// Removes an adorner when it is no longer used. /// </summary> /// <param name="adorner"></param> public virtual void RemoveAdorner(HighlightAdorner adorner) { if (adorner != null && AdornerLayer != null) { AdornerLayer.Remove(adorner); adorner.Unregister(); adorner.RenderImpossible -= new EventHandler(adorner_RenderImpossible); } }