This is a migrated thread and some comments may be shown as answers.

Problem in createing dynamic menu

2 Answers 70 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Bichitra
Top achievements
Rank 1
Bichitra asked on 22 Sep 2008, 01:51 PM
Hi,

I have another issue.

I did not get any property  to get imediate parent RadmenuItem objectfrom the Child RadMenuItem object. 

I was trying to store Parent RadMenuItem object to the child RadMenuItem object through Tag property.

Ex:  RadMenuItem Item1 = new RadMenuItem(){Header="Item1"};
RadMenuItem item2 = new2 RadMenuItem(){Headre="item2};
item2.Tag= item1;

And I have added the menuitem to theRadMenu.
and when i was trying to show in Grid. it is giving  "SystemStack flow Exception" I I removed the tag property it working fine.

Can you help to fix this issue. I am trying to build a menu  dynamically to read Xml file.


Thanks
Bichitra

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 23 Sep 2008, 12:49 PM
Hi Bichitra,

With current version if RadMenuItem has been loaded you can use ItemsControl.ItemsControlFromItemContainer method. With next version of RadMenu you'll be able to use Parent property and cast it to RadMenuItem to get the ParentItem of some RadMenuItem (next version is scheduled till the end of week).

Currently Silverlight 2 don't support adding UIElement that are in the visual tree to Tag property. That is why you get "StackOverflow exception".

Why do you need parentMenuItem? What do you want to achieve?
You can see example on how to create menu from XML in our online examples here:
http://demos.telerik.com/silverlight/#Examples/Menu/XMLSource


Kind regards,
Hristo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Bichitra
Top achievements
Rank 1
answered on 23 Sep 2008, 01:35 PM
HI,

Thanks for helping

I am loading XML file on demand. I mean i am using webclient to download and  read xml file  using XmlReader to build Menu. I did the solution doing some work around using collection. I will try to use "ItemsControl.ItemsControlFromItemContainer "

Thanks
Bichitra 
Tags
Menu
Asked by
Bichitra
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Bichitra
Top achievements
Rank 1
Share this question
or