You can add a context menu to tab control or to individual tabs. If you add it to tab control it works on anywhere in the tab area. If you add it to a tab item, it only works on that tab item. Take a look at this code:

<TabControl
Name=tcMain >

    <TabControl.ContextMenu>

        <ContextMenu
Name=mnuTabContext1>

            <MenuItem
Header=_Vertical Tab
Name=mnuVerticalTab1></MenuItem>

            <MenuItem
Header=_Horizontal Tab
Name=mnuHorizontalTab1></MenuItem>

        </ContextMenu>

    </TabControl.ContextMenu>

    <TabItem
Name=tabNew
Header=[new]
IsTabStop=False >

        <TabItem.ContextMenu>

            <ContextMenu
Name=mnuTabContext>

                <MenuItem
Header=_Vertical Tab
Name=mnuVerticalTab></MenuItem>

            </ContextMenu>

        </TabItem.ContextMenu>

    </TabItem>

</TabControl>

If you click on the tab control, you get:

But if you click on the tab itself, you get:

This entry was posted on Thursday, March 8th, 2007 at 5:11 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.