Have you seen the Adornment Buttons sample? In that sample, buttons are displayed upon selecting a node, and you’ll also notice the one of the buttons uses a Binding on the color of the node data. You could use a similar Binding to toggle visibility of buttons based on some node data properties.
Sure, define an Adornment, then show it as part of your button’s click function. You may also need to hide it as part of the click functions within the Adornment itself.
We have the Hover Buttons sample which does this upon hover rather than clicking a button.
I did below code… not working please advise… no errors. but when i hover nothing is shwoing…
{ // show the Adornment when a mouseHover event occurs
mouseHover: function(e, obj) {
var node = obj.part;
nodeHoverAdornment.adornedObject = node;
node.addAdornment(“mouseHover”, nodeContextMenuAdornment);
}
var nodeContextMenuAdornment = $(
go.Adornment,
“Vertical”,
$(
“ContextMenuButton”,
$(go.TextBlock, "View Command Info "),
{
}));
Yes walter I got that. Context menu should show when i click button or hover on the node. “Not the Right click”… how to show context menu when i click button?