Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="http://gitscc.codeplex.com" rel="noreferrer">Git Source Control Provider</a> is an open source extension includes a tool pane that embeds a standard editor as a control within a custom WPF tool window. I would use this code as a reference for any Visual Studio 2010+ extension where I wanted to host an editor window in some custom location.</p> <ul> <li><a href="https://github.com/yysun/Git-Source-Control-Provider/blob/master/PendingChangesView.xaml" rel="noreferrer"><code>PendingChangesView.xaml</code></a> includes a <code>ContentControl</code> named <code>DiffEditor</code>, the content of which will be the editor.</li> <li><a href="https://github.com/yysun/Git-Source-Control-Provider/blob/master/PendingChangesView.xaml.cs" rel="noreferrer"><code>PendingChangesView.xaml.cs</code></a> includes a method <code>ShowFile</code>, which calls a method to create the editor control and assigns the result as the content of <code>DiffEditor</code>.</li> <li><a href="https://github.com/yysun/Git-Source-Control-Provider/blob/master/ToolWindowWithEditor.cs" rel="noreferrer"><code>ToolWindowWithEditor.cs</code></a> includes a method <code>SetDisplayedFile</code> which returns a <code>Tuple&lt;Control, IVsTextView&gt;</code> interface, which provides access to a <code>Control</code> that can be added to a <code>ContentControl</code> as well as the <code>IVsTextView</code> for the text view. <strong>The heavy lifting is in this method.</strong></li> </ul> <p>Note that the <code>SetDisplayedFile</code> method includes several lines with the following form:</p> <pre><code>textViewHost.TextView.Options.SetOptionValue({name}, {value}); </code></pre> <p>These lines perform key functionality for the Git Source Control Provider such as removing margins and making the window read only. There are many options available, so you'll want to review the documentation for <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.text.editor.defaulttextviewoptions.aspx" rel="noreferrer"><code>DefaultTextViewOptions</code></a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.text.editor.defaulttextviewhostoptions.aspx" rel="noreferrer"><code>DefaultTextViewHostOptions</code></a> to apply the ones appropriate for your particular extension.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload