I'm looking at a ContentGeneratorWPF sample in the REX SDK. I want to add my own menu items to the Revit extension menu. I can add the commands and menuItem in the MainControl.xaml file and it appears fine in the VS2010 designer, but when I run the menu is not visible. I tried setting the visibility in the OnLayout overload but still had no success. How can we add an item to the extension?
In the sample ContentGeneratorWPF in the SDK, you will see MainControl.xaml. There is a menu item called Calculations in the design view. It doesn’t appear when running in the Revit.
In order to make the menu visible, you will need to modify the code in:
Extension.cs >> OnCreateLayout(), and add:
Below is the whole OnCreateLayout() method:
public override void OnCreateLayout()
// (1) added the menu on the dialog
REXLayoutItem.LayoutType.Layout, "Element", "",
"Element", (long)0, SelectedElementControlRef,
"", "Recognition", (long)0, CGReadControlRef,
"", "Creation", (long)0, CGCreateControlRef,
// (2) added
// Menu is visible
// Command is visible
// insert code here.
if (ExtensionRef != null)
After this modification, the menu becomes visible.