Hi,
I am using XamDockManager. With in that I have a pinned Pane.
With in the Pane, I Have a Button with Context menu. When I select his context menu, the this pane is getting hide/Pinned
But we are not expecting same to be pinned that time.
Could anybody help me to resolve this issue.
Thanks & Regards,
Ravishankar
Thank you Smith.
I made change accordingly and that resolved my issue.
Regards,
Ravishankar.
I believe it is because you are setting the PlacementTarget after the ContextMenu has been opened. Make sure to set the IsOpen to true last.
Hello Smith,
What you told is absolutluy correct for context menu on right click.
For me, have to show the context menu on left button click.
So I am capturing the click event of my button thru commad in my view model and there itself i am binding the Context menu to that button.
That time I am getting above specified issue.
Please see my code for binding the context menu.
var button = (ToggleButton)executedRoutedEventArgs.Parameter; button.ContextMenu = new ContextMenu(); var menuItemCollection = new List<MenuItem>(); foreach (var datapointType in datapointTypes) { var menuitem = new MenuItem(); menuitem.Header = datapointType.Key; menuItemCollection.Add(menuitem); } button.ContextMenu.ItemsSource = new ListCollectionView(menuItemCollection); button.ContextMenu.Tag = button; button.ContextMenu.IsOpen = true; button.ContextMenu.PlacementTarget = button;
Could you please verify same and let me know your comments.
Thanks,
So just to be clear, you have a pane that is "unpinned" - i.e. its IsPinned is false. As long as an element within that ContentPane contains the keyboard focus, the unpinned flyout should remain open (and therefore the pane within it remains visible). Typically if you right click on something (e.g. I tried with a TextBox) it will take the keyboard focus and then show its ContextMenu (which itself takes the keyboard focus). If you still have an issue then perhaps you can provide a project that demonstrates the issue so we can see what is happening?