I’ve looked at the examples on using context menus and searched the forums for answers but still can’t find guidance on how to deal with a couple of issues. We are placing our context menu on individual nodes, using the contextMenu attribute. We have a few questions that I haven’t been able to figure out how to get around:
-
We want to style the background of each of the ContextMenuButtons to have a background that is something different than the default white to gray gradient. I have tried setting the background and areaBackground attributes on the Adornment, the ContextMenuButton and the TextBlock. The closest I have come to getting this to work is setting the background on the TextBlock which changes the background on the text but not the padded area around it. Is it possible to style the whole area?
-
We would like to use a binding on the data attached to the node to disable specific ContextMenuButtons when the data object is in a certain state, preferring to show them in a subdued greyed out state and not allowing them to be clicked. Is that possible and if so how?
I have tried a bunch of different iterations but just haven’t seemed to get it right. Any guidance would be greatly appreciated. Here is how we are defining the context menu for our Node object
contextMenu:
GO(go.Adornment, "Vertical",
GO("ContextMenuButton",
GO(go.TextBlock,
new go.Binding("text","", getExportDatasetContextMenuName),
{
margin: 5,
font: pfdStyles.dataNodeFont,
textAlign: "left",
click: exportDataset
})
),
GO(“ContextMenuButton”,
GO(go.TextBlock,
new go.Binding(“text”,"", getImportDatasetContextMenuName),
{
margin: 5,
font: pfdStyles.dataNodeFont,
textAlign: “left”,
click: importDataset
})
)
)