Is there any way to trigger if an item is right clicked? I would like to show my own context-menu in this case but I find no way to detect the right click. ItemClick does not work for the right mouse button. So I could use MouseClick, but I don't find a way to check if the mouse location is within an item or not..
Or is it preferred to modify the default context menu to fit my needs?
Thanks,Stefan
Edit: I just found the function ItemFromPoint() which works fine. Now I only have problems when showing a context-menu for a group. GroupFromPoint() returns the group when I click on an empty place within a group and therefor the menu will be shown. I would like to restrict this to the group header only. When I use the GroupClick event it is only fired when I click on the group itself, this would be the desired way..
I just use the context menu to open a openfiledialog where the user can select an icon that is shown for the clicked item or group..
ItemFromPoint/GroupFromPoint don't tell you what part of the item/group was clicked, so you would have to manually hit test for the constituent part you are looking for:
void ultraExplorerBar1_MouseDown(object sender, MouseEventArgs e){ UltraExplorerBar explorerBar = sender as UltraExplorerBar; UIElement controlElement = explorerBar.UIElement; UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null;
while ( elementAtPoint != null ) { UltraExplorerBarGroupHeaderUIElement headerElement = elementAtPoint as UltraExplorerBarGroupHeaderUIElement;
if ( headerElement != null ) { UltraExplorerBarGroup group = headerElement.Group; }
elementAtPoint = elementAtPoint.Parent; }}
Thanks for your help. This is the desired way to check if a group was right clicked.
I'm sorry to disturb you again, but I found a small issue, after changing the image of an item or a group.
After changing the icon of an item there is sometimes no effect visible. The image is updated when I hover the item again.
I am setting the icon to an item using this code:actItem.Settings.AppearancesLarge.Appearance.Image = New Bitmap(.FileName)
I also tried to use .refresh on the whole explorerbar, but this also has no effect. In some cases the icon is updated immediatelly..
Is there a way to update the changed items and groups after changing the appearance?
Thanks again, now that works great...
Try UltraExplorerBar.UIElement.DirtyChildElements( true )