Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used a XamDataTree control in my App and I want show different Menu when mouse right click on XamDataTree Nodes. problem is when click , how can I know mouse is on which Layout?

on my application , there is two Layout as blow:

NodeLayout mylayout = new NodeLayout();
mylayout.Key = "FristLayout";
mylayout.TargetTypeName = "Category";
mylayout.DisplayMemberPath = "CategoryName";

NodeLayout mylayout2 = new NodeLayout();
mylayout2.Key = "SecondLayout";
mylayout2.TargetTypeName = "Product";
mylayout2.DisplayMemberPath = "FileName";


I want to show one menu for FristLayout and different menu for SecondLayout.

is there any idea or help?

thanks in advance.
Posted

1 solution

I solved it , the idea is below:

1.Create Menu when Click event of XamDataTree.
2.Detect the selected Elements in the Opening Event of Menu,like below
var node = e.GetClickedElements<XamDataTreeNodeControl>().FirstOrDefault();
           if (node != null && node.Node.NodeLayout.Key == "FristLayout")
{
  //add menu items here
}
     
Done!     
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900