Tengo ProjectItem y quiero obtener el IWPFTextView que está asociado con él, si lo hay.Encuentre un IVsTextView o IWpfTextView para un ProjectItem dado, en la extensión VS 2010 RC
He intentado obtener un IVsTextManager, y luego recorrer las vistas, pero iVsTextManager.EnumViews siempre devuelve nada.
Aquí es lo que tengo hasta ahora:
var txtMgr = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager));
if (txtMgr != null)
{
IVsEnumTextViews iVsEnumTextViews;
IVsTextView[] views = null;
// Passing null will return all available views, at least according to the documentation
// unfortunately, this returns a 0x80070057 error (invalid parameter)
var errorValue = txtMgr.EnumViews(null, out iVsEnumTextViews);
if (errorValue == VSConstants.S_OK)
{
// enumerate, find the IVsTextView with a matching filename.
Seguramente hay otro/mejor manera ??
Gracias de antemano
~ Cameron
Y ¿cómo se consigue la wpfTextView ?. ¡Gracias! – Morvader
Genial. Gracias por este método de ayuda. Realmente me ayudó mucho para resolver un problema similar. –
Usando su método, esto es lo que resolví por mí mismo: http://stackoverflow.com/a/24178352/395069 –