This project has moved. For the latest updates, please go here.

Closed code appears collapsed



I have a documentation project where I would like to show some samples in c# and vbnet. I use the tag <code> as follows:

<code source="SamplesVB.vb" region="Sample3" language="vbnet"/>

<code source="SamplesCS.cs" region="Sample3" language="cs"/>

At the chm output file, I could see the c# code section correctly expanded, but the vbnet code section appears collapsed.

I have checked the code block component configuration to modify the default language to VB.NET, but does not change anything.

There is any way that both code samples section appears expanded, or at least select which of both section appears expanded by default?

Update, 04/13/2014 - The issues with improper tab visibility and default language selection will be addressed as I move the syntax and code section functionality from the branding transformations back into the presentation style.

file attachments

Closed May 5, 2014 at 3:03 AM by EWoodruff
Fixed via removal of the branding transformations and implementation of new grouping and sorting support in the SyntaxComponent.


EWoodruff wrote Apr 12, 2013 at 8:28 PM

What presentation style are you using? The VS2010 style doesn't collapse sections, it uses tabs. Those tabs are in a set order. You can modify the presentation style to alter which language type is shown by default. If you're using the VS2005 style, all code is shown by default. However, if you've modified the code filter found at the top of the page, it might not be showing everything. The setting is sticky and will persists across builds. The fix is to click the Code link at the top of one of the topics and make sure all of languages you want to see are checked.

wrote Apr 15, 2013 at 10:01 AM

ernicho wrote Apr 15, 2013 at 10:01 AM

Thanks for your help.

I am using VS2010 presentation style. The problem is that when I try to add a sample code using the followind code:
<code language="vb">
  Imports xxx.yyy
<code language="cs">
  using xxx.yyy;

it is shown in 2 different sections, each one with several tabs (c#, vb, c++, f#) and higlighted the tab with the default language that I specify at <code language="xx"> parameter. But the first code section appears collapsed till I click the title tab, althought the second code section is showed/expanded correctly.

It would fine for me, show both code (c#, vb) in one single section in different tabs, but I don't know how to achieve that.

I attach a sample image of the resulting chm to help to understand this issue.

Also, I have tested the VS2005 presentation style and both code sections are showed fine but I would like to use the newer VS2010 style.

Thanks in advance,


EWoodruff wrote Apr 15, 2013 at 8:24 PM

I think this is related to how the VS2010 XSL transformations are grouping the code examples. It's probably applying a "hidden" attribute inappropriately in this particular case. Can you post or attach the XML comments or MAML snippet that is causing this issue so that I can duplicate it and see if there's a fix? Include the surrounding elements too as it's probably based on the context in which the code elements are used.

wrote Apr 19, 2013 at 8:31 AM

ernicho wrote Apr 19, 2013 at 8:31 AM

Hi Eric,

I have done some more test and I have found that the problem was that the code was not added inside a <section> tag, and so was not displayed at the correct tab.

I have attached the sample prj to see the results of both options, <code> with and without <section> tag, if you want to see what is happening.

Anyway, now I have also detected that the default selected tab is always c#. At code block component I have set as default language vb .net, but still is always shown as default the c# tab.

How can I set the code for to have as default code tab selected the VB?

Thanks again,


EWoodruff wrote Apr 19, 2013 at 8:15 PM

See this thread for information on how to modify the XSL transformations and branding files to make VB.NET the default selection:

wrote May 16, 2013 at 8:30 PM

wrote Apr 14, 2014 at 6:41 AM

wrote May 5, 2014 at 3:03 AM

wrote May 5, 2014 at 3:03 AM