Hi again
I have defined a custom Design view for my own Xml files, as in the VS SDK sample SampleDocViewEditor for Addin files.
This sample provides immediate sinchronization between the 2 views thru the text buffers, but I want a solution similar to the VS Forms Designer, where synchronization (view drawing /code generation) happens when the views get focus or the tabs are selected.
I tried to capture focus events on the design view with no success, althou I know this is not the best solution (kind of a Form.Activate event would be better, but I have no forms, only Controls on my views)
How can I do this using the VS integration in the best way
Ideas are welcome...
Thanks
j.g.

Capturing the events regarding switching between code /design view
philippel
Hi Joao,
I'm trying to change SampleDocViewEditor extension from .ADDIN to .SXVID, that I think is what You have done.
After changing the extension, I can open the new item in the VS 2005, but I can't see the View Code/View Designer menu items from the solution explorer context menu.
I have renamed ADDIN.ADDIN file to SXVID.ADDIN file and the ADDIN.ICO to SXVID.ICO and more the .VSDIR file initial content from ADDIN.ADDIN to SXVID.SXVID.
Any hints
Thank You
Lorenzom
You should be able to implement IVsWindowFrameNotify.OnShow to determine when the editor in question is activated. OnShow will be called with the FRAMESHOW_TabActivated value.
Another possible option would be to implement IVsSelectionEvents.OnCmdUIContextChanged and look to see if the context cookie corresponds to either of the views you wish to support. I'd probably opt for implementing IVsWindowFrameNotify on my editor object, and call IVsWindowFrame2.Advise() from the editor's SetSite implementation. The IOleServiceProvider passed to your editor's IVsWindowPane.SetSite, can be used to retrieve the IVsWindowFrame via the SVsWindowFrame service.
Something along the lines of :
public int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider psp)
{
vsServiceProvider = new ServiceProvider(psp);
IVsWindowFrame vsWindowFrame = vsServiceProvider.GetService(typeof(SVsFrameWindow)) as IVsWindowFrame;
IVsWindowFrame2 vsWindowFrame2 = vsWindowFrame as IVsWindowFrame2;
vsWindowFrame2.Advise(this, out winframeCookie);
return VSConstants.S_OK;
}
Josh K
Thanks,
Kenneth
jandizon
Craig
Ankur Goel
If you are extending it like the sample, you need to modify the extension being registered as an "XML" filetype.
Otherwise, you need to change the projectitem subtype to "Designer" via code or in a template ala
<
ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.SXVID" SubType="Designer">File1.SXVID</ProjectItem>Joltan
Hi Craig,
I'm trying to change SampleDocViewEditor extension from .ADDIN to .SXVID.
After changing the extension, I can open the new item in the VS 2005, but I can't see the View Code/View Designer menu items from the solution explorer context menu.
I have renamed ADDIN.ADDIN file to SXVID.ADDIN file and the ADDIN.ICO to SXVID.ICO and more the .VSDIR file initial content from ADDIN.ADDIN to SXVID.SXVID.
Any hints
Thank You