I would like to add a contextmenu in the oulook bar. How can I do that?
In all likelihood you would have to walk up the visual/logicaltree but can you post a sample of what you are doing so I see? If you just want to be able to get to the group from the menuitem click then perhaps you can walk up the logical tree of the menu item in the click until you get to the ContextMenu and then use the PlacementTarget of the ContextMenu to determine the group to act on. ContextMenu usage really isn't specific to this control so you may find more information on the MS WPF newsgroups as well.
You can add a context menu using a style:
<Window.Resources>
<ContextMenu x:Key="contextMenu">
<MenuItem x:Name="menuItem1" Header="Action 1" Click="menuItem_Click" />
<MenuItem x:Name="menuItem2" Header="Action 2" Click="menuItem_Click" />
</ContextMenu>
<Style TargetType="igOutlookBar:OutlookBarGroup">
<Setter Property="ContextMenu" Value="{StaticResource contextMenu}"/>
</Style>
And then you can use placementTarget property to identify the group:
{
MenuItem menuItem = sender as MenuItem;
OutlookBarGroup gr= menu.PlacementTarget as OutlookBarGroup;
}
I figured out how to add it, how do I determine which group bar I am in when the user right clicks. I add the groups in code behind based on the results of a query.