Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6661465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:16:59+00:00 2026-05-26T02:16:59+00:00

I am in the focus of a ToolWindow. By doing dobleclick on a TreeView

  • 0

I am in the focus of a ToolWindow. By doing dobleclick on a TreeView node, the cursor has to move to a particular line within the opened source code document. I solved this issue by calling the Edit.GoTo Line command like this:

var commandName = "Edit.GoTo " + lineNumber;
_dte.ExecuteCommand(commandName);

However I am not quite convinient with that as I lose the focus of the toolwindow. Is there another way to move to a line by using the Automation API?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:16:59+00:00Added an answer on May 26, 2026 at 2:16 am

    Use the IViewScroller.EnsureSpanVisible(SnapshotSpan span, EnsureSpanVisibleOptions options)

    To create a span, use:

    var lines = view.VisualSnapshot.Lines;
    
    var startLine = lines.FirstOrDefault(a => a.LineNumber == fromLine - 1);
    var endLine = lines.FirstOrDefault(a => a.LineNumber == toLine - 1);
    
    if (startLine == null || endLine == null)
        return;
    
    var startPosition = startLine.Start;
    var endPosition = endLine.Start;
    
    var span = new SnapshotSpan(view.TextSnapshot, Span.FromBounds(startPosition, endPosition));
    

    And to scroll to the span:

    layer.TextView.ViewScroller.EnsureSpanVisible(span,
        EnsureSpanVisibleOptions.AlwaysCenter);
    

    Where view is the IWpfTextView provided by your adorner (IWpfTextViewCreationListener)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Button lost focus: Button has focus: Short code: MLibrary = new JButton(); MenuPane.add(MLibrary, new
When I tried to focus on compiler in code, I made break point on
Has anyone used the focus mode FOCUS_MODE_EDOF, provided in the android CameraParameters? http://developer.android.com/reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_EDOF I
$(#myinputfield).focus(); Doing that on an input field with it's value already set causes the
Need to somehow lose focus on <select> after the <option> has been selected. http://jsfiddle.net/MnAdN/
I am trying to focus on a particular list view in a tree, I
The focus visual hint that wpf provides on Windows 7 is a dashed line,
I need to focus on a textbox after an item has been selected from
You can pass focus to an element in javascript as such: element.focus() I'm doing
GTK+ Button widget has focus_on_click property that controls grabbing of focus. But I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.