locked
What's VS 2010 Xaml editor UI context Guid? RRS feed

  • Question

  • Hi all,

    Was wondering if somebody could help me figure out Guid of VS 2010 Xaml editor UI context when it's in XAML view, ie not in Design one. On VS 2008 VSConstants.GUID_TextEditorFactory used to work just fine but it doesn't seem to be used for Xaml files on VS 2010 anymore. I'm using IVsSelectionEvents, OnCmdUIContextChanged() in particular, and it no longer works on VS 2010.

    Any help would be greatly appreciated. Thanks!


    Sergey (DPack - www.usysware.com/dpack/)
    Saturday, November 20, 2010 10:00 PM

Answers

  • It looks like the editor is pushing the language service GUID of the XAML language service.  We don't appear to expose that GUID anywhere :(, but since I don't think there is anything dastardly you could do with such knowledge it is

    {c9164055-039b-4669-832d-f257bd5554d4}

    Though this question may have been more appropriate for the editor forum since it is editor specific.  If you have follow ups as to editor specific bits around why they push this UI context or differences you notice between UI context activations in 2008 and 2010 the editor forum may be a faster place to get an answer.

    Ryan

    Saturday, November 20, 2010 10:42 PM

All replies

  • So you are calling OnCmdUIContextChanged yourself?  That is kind of odd, normally only the shell should be calling that as pushing/popping UI contexts can be a kind of complex task to do correctly and, more importantly, at the right time.  What are you accomplishing by setting/clearing that UI context?

    Ryan

    Saturday, November 20, 2010 10:25 PM
  • It looks like the editor is pushing the language service GUID of the XAML language service.  We don't appear to expose that GUID anywhere :(, but since I don't think there is anything dastardly you could do with such knowledge it is

    {c9164055-039b-4669-832d-f257bd5554d4}

    Though this question may have been more appropriate for the editor forum since it is editor specific.  If you have follow ups as to editor specific bits around why they push this UI context or differences you notice between UI context activations in 2008 and 2010 the editor forum may be a faster place to get an answer.

    Ryan

    Saturday, November 20, 2010 10:42 PM
  • Hi Ryan,

    My VS package implements IVsSelectionEvents. I use IVsMonitorSelection to "advise" for selection events via AdviseSelectionEvents(). Once setup, my package's OnCmdUIContextChanged() gets called. That's where I attempt to detect if context I'm interested in is being activated or deactivated.

    Thanks.


    Sergey (DPack - www.usysware.com/dpack/)
    Sunday, November 21, 2010 4:04 PM
  • Hi Ryan,

    Yep, just verified it and it appears to work now. That's the Guid I was looking for. That's too bad it's not exposed anywhere. I sort of expected it to find under Microsoft.VisualStudio.Shell.Interop.UIContextGuids100 or EnvDTE100.

    Thanks for your help. Much appreciated.


    Sergey (DPack - www.usysware.com/dpack/)
    Sunday, November 21, 2010 4:15 PM
  • Well it isn't a UI context per se, it is the GUID that identifies the XAML language service, it just is being used here as a UI context.  I will check with some editor folks and see the best way to expose these if we are also using them as UI contexts.

     

    Ryan

    Sunday, November 21, 2010 5:38 PM