Welcome Guest Search | Active Topics | Sign In | Register

TreeNode.Navigator is null Options
kraeki
Posted: Friday, December 4, 2009 4:41:14 AM
Rank: Newbie
Groups: Member

Joined: 12/4/2009
Posts: 7
Hello

I'm creating a TreeNode like the following code shows:

Code: C#
TreeNode myTreeNode = new TreeNode();
myTreeNode.Text = "TreeNode1";


Now I'd like to add a specific Event to fire when the TreeNode has been clicked:

Code: C#
myTreeNode.Navigator.ItemClick += 
               new NavigationItemEventHandler(OnNavigatorItemClick);


The OnNavigatorItemClick-Methode still exists, but the problem is that the navgator is null.

Why is it null? Shouldn't it has been initialized? What can I do to initialize it?

I really appreciate for your answers!
eo_support
Posted: Friday, December 4, 2009 7:03:16 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Navigator property is only initialized after you add the TreeNode into a TreeView. Because you anyway need the TreeView object, so usually you should just reference the TreeView object directly.

Thanks!
kraeki
Posted: Friday, December 4, 2009 7:17:15 AM
Rank: Newbie
Groups: Member

Joined: 12/4/2009
Posts: 7
Ah ok...
So does it mean thaht it's impossible to differentiate which item was clicked over specific click-events?

Is it true that there is just one click-event which I can specify? I mean the one from the TreeView itself? In that case I have to differentiate which item was clicked in that one e. g. over value-property, right?

Thanks for your answer!
eo_support
Posted: Friday, December 4, 2009 7:24:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
There is only one handler. But the handler passes the clicked node to you through event arguments. You can check the source code for this sample to see how it works:

http://demo.essentialobjects.com/Default.aspx?path=Menu\menu_programming\_i1\menu_server_event

The sample is for Menu, but the idea is exactly the same.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.