Am not sure if this has been asked before. If so, please feel free to point to that direction.
What I want to do is to bind a RadMenu to an XML file. The items are fairly static and that is why I chose an XML file. I also have the option to put in multiple xml files and do the binding run-time and point to the correct xml file as the situation calls for it.
Thanks in advance!
6 Answers, 1 is accepted
To data-bind RadMenu to a XML file you should read it and create collection of objects, containing the needed properties for every XML element, then provide that collection as a ItemsSource on RadMenu.
In my opinion it would be easier to use a XAML file instead of XML, like we do in the following example:
http://demos.telerik.com/silverlight/#Menu/DataBinding
Greetings,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I took a look at using a xaml file as the "datasource" but there is one line in the sample that I can't seem to understand:
xmlns:menuModel="clr-namespace:Examples.Menu.Common;assembly=Examples.Menu
I tried to declare/register it on my own project named sampleMenu but my intellisense fails.
Thanks in advance!
This line declares a XML namespace for the objects that are inside the file. It works as any other similar declaration in your other XAML files. To fix it:
xmlns:menuModel="clr-namespace:Examples.Menu.Common;assembly=Examples.Menu"
would become:
xmlns:menuModel="clr-namespace:<namespace>;assembly=<assembly>"
where <namespace> should be the namespace where the MenuModel and MenuItem classes are declared; <assembly> should be the assembly which contains those classes.
In our example the namespace is Examples.Menu.Common (see the MenuItem.cs for example) and the assembly is named Examples.Menu (this is set in the project properties).
Kind regards,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
i have follwed the below link
http://demos.telerik.com/silverlight/#Menu/DataBinding
in that i ahve taken the sample of code hwich is using for rad menu binding.
but i am getting error.
xmlns
:menuModel="clr-namespace:Example.Menu.Common;assembly=Example.Menu"
from this line i am getting the error as MenuItemColltecion is not found.
i have checked the path/namespace is corect.
could you please help me on this.
i have follwed the below link
http://demos.telerik.com/silverlight/#Menu/DataBinding
in that i ahve taken the sample of code hwich is using for rad menu binding.
but i am getting error.
xmlns
:menuModel="clr-namespace:Example.Menu.Common;assembly=Example.Menu"
from this line i am getting the error as MenuItemColltecion is not found.
i have checked the path/namespace is corect.
could you please help me on this.
Please find attached an isolated project demonstrating the needed approach.
Hope it helps.
Regards,
Yana
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!