I am trying to manipulate the Visual Studio Text Editor scrollbar values. The problem is that I have only the dte.ActiveDocument and it is not possible to do it from there.
My extension is loaded only once when VS starts and I capture dte.Events.CommandEvents. At some point I want to change the scrollbar values for the ActiveDocument. To do this I need IWpfTextView or ITextView. Do you have any idea how can I get an instance of that object?
internal class MyExtension
{
private CommandEvents commandEvents;
private DTE dte;
public MyExtension(DTE dte)
{
this.dte = dte;
commandEvents = dte.Events.CommandEvents;
commandEvents.BeforeExecute += commandEvents_BeforeExecute;
}
void commandEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)
{
var doc = dte.ActiveDocument
// CHANGE SCROLLBAR VALUES HERE
}
}