Hello~
In ContentPane, when I mouse right button click I can see the context menu.
But I want to display the context menu when I click a button in the content pane tab header.
Is there a way?
Hello,
To the best of my knowledge there is no way to do this directly.
What I could suggest is get the tooltip, place it in a Popup and then show the popup when the button is clicked.
Hope this helps,
Alex.
Hello alex~
Thank you for quick reply. You mean , I have to make popup window(or user control) and then show the popup winodw?
Here is my xaml source...
<DataTemplate x:Key="myDataTemplate"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding}" ToolTip="{Binding}"></TextBlock> <Button Name="btnShowContextMenu" /> </StackPanel> </DataTemplate>
This code used in ContentPane TabHeaderTeplate.
Yes,
Here is the code snippet that I used to create this:
Popup p = new Popup();
p.Placement = PlacementMode.MousePoint;
ContentPane pane = Utilities.GetDescendantFromType(this, typeof(ContentPane), false) as ContentPane;
p.Child = new TextBlock() { Text = pane.ToolTip.ToString(), Foreground=Brushes.White};
p.IsOpen = true;
p.StaysOpen = false;