Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
How to find parent xam data tree node of context menu
posted

I want to find the active node on which context menu was opened and a menu item was selected. I wrote the below code but it didnt work.

Flow of events is:  node->rt click->context menu->first menu item selected->menu closes

private void XamContextMenu_ItemClicked(object sender, ItemClickedEventArgs e)
{
string tblName = null, dbName = null;
if (e.Item.Header.ToString() == "Add to Group")
{
XamDataTreeNode currentNode = Utilities.GetAncestorFromType(e.Item.Parent as DependencyObject, typeof(XamDataTreeNode), true) as XamDataTreeNode;
if (currentNode != null)
{
tblName = ((Tables)currentNode.Data).TableName.ToString();
XamDataTreeNode parentNode = currentNode.Manager.ParentNode;
dbName = ((Databases)parentNode.Data).DBName.ToString();
DataSet ds = Program.GetColFromTable(tblName, dbName);
if (outputRawData == null)
outputRawData = new DataSet();
outputRawData.Tables.Add(ds.Tables[0]);
ReRenderGrid(ds);
}
}
}