I am using XamMenu for our primary application menu. Rather than hard code or add all the menus on the fly I want to use data binding. Our application menus are currently defined in XML. I can use linq to put them in an object graph if needed.
Reading the docs it talks about creating a hierarchal template but seems to say you need to create one for each menu level you need. Our menu structure is 100% defined in the XML.
First, is it possible to bind to XML or will I need to bind to an object graph.
Are there any examples of fully data driven XamMenus with random level depths.
BOb
Francis,
Ok, here is one of our menu files. What I have done currently is in my menu service I project it to an object graph of a MenuItem class:
public class MenuItem
{
[Key]
public int Id { get; set; }
public string MenuTitle { get; set; }
public string NavigationUri { get; set; }
public string NodeProvider { get; set; }
public string NodeSource { get; set; }
public int ParentMenuId { get; set; }
[Include]
[Composition]
[Association("Children","Id","ParentMenuId")]
public IList<MenuItem> Children { get; set; }
public MenuItem()
Children = new List<MenuItem>();
}
But, I can always return the raw XML is that will work better. Here is one of our smaller menu files:
Hmm... I don't see a way to attach stuff here. So, I'll just post the XML in, it is not too big.
<?xml version="1.0" encoding="utf-8" ?>
<TOC>
<NODE text="Configure" description="Configure Evolution Data Exchange Authentication Users" HeaderText="eDex" status="closed" requiredPermissions="eDex.Configure" possiblePermissions="eDex.Configure">
<NODE text="Users" description="Setup Users and Passwords" HeaderText="eDex" status="closed" navigate="EDEXWeb/frmAuthenticationUsersGrid.aspx" requiredPermissions="eDex.Configure" possiblePermissions=""/>
</NODE>
<NODE text="eSite" description="eSite" HeaderText="eDex" status="closed" requiredPermissions="eDex.eSite" possiblePermissions="eDex.eSite,eDex.eSite.LeasingReports,eDex.eSite.LeasingReports.View">
<NODE text="Mapping Tables" description="Mapping Tables" HeaderText="eDex" status="closed" requiredPermissions="" possiblePermissions="eDex.eSite.PropertyMapping,eDex.eSite.IncomeCodeMapping,eDex.eSite.UnitTypeMapping,eDex.eSite.ReturnPaymentFees">
<NODE text="Property Mapping" description="Property Mapping Table" HeaderText="eDex" status="closed" navigate="EDEXWeb/frmPropertyMappingGrid.aspx" requiredPermissions="eDex.eSite.PropertyMapping" possiblePermissions=""/>
<NODE text="Income Code Mapping" description="Income Code Mapping Table" HeaderText="eDex" status="closed" navigate="EDEXWeb/frmIncomeCodeMappingGrid.aspx" requiredPermissions="eDex.eSite.IncomeCodeMapping" possiblePermissions=""/>
<NODE text="Unit Type Mapping" description="Unit Type Mapping Table" HeaderText="eDex" status="closed" navigate="EDEXWeb/frmUnitTypeMappingGrid.aspx" requiredPermissions="eDex.eSite.UnitTypeMapping" possiblePermissions=""/>
<NODE text="Return Payment Fees" description="Return Payment Fees" HeaderText="eDex" status="closed" navigate="EDEXWeb/frmReturnPaymentFeesGrid.aspx" requiredPermissions="eDex.eSite.ReturnPaymentFees" possiblePermission=""/>
<NODE text="Reports" description="Reports of webservices activity" HeaderText="eDex" status="closed" requiredPermissions="eDex.Reports.WebServicesActivity" possiblePermissions="eDex.Reports.WebServicesActivity">
<NODE text="Webservices Activity" description="Webservices Activity Summary" HeaderText="eDex" status="closed" navigate="EDEXWeb/frmWebserviceReport.aspx" requiredPermissions="eDex.Reports.WebServicesActivity" possiblePermissions=""/>
<NODE text="Housekeeping" description="Housekeeping functions" HeaderText="eDex" status="closed" requiredPermissions="eDex.Reports.WebServicesActivity" possiblePermissions="eDex.Housekeeping.PurgeWebServicesActivity">
<NODE text="Purge Webservices Activity" description="Purge Webservices Activity" HeaderText="eDex" status="closed" navigate="EDEXWeb/frmPurgeWebservicesActivity.aspx" requiredPermissions="eDex.Housekeeping.PurgeWebServicesActivity" possiblePermissions=""/>
<NODE text="About" HeaderText="eDex" description="" status="closed" navigate="EDEXWeb/frmAbout.aspx" requiredPermissions="eDex.About" possiblePermissions="eDex.About"></NODE>
</TOC>
Bob,
The XamDataTree will not be the best option. We may be able to get this to work now with the XamMenu with its current features. Please attach a sample XML file that you might use build a menu. I think we may be able to employ LINQ To XML to get this working.
Thanks,
I am still researching the option of using the XamDataTree in lieu of the XamMenu. As for the XamMenu, I have logged a Feature Request with Product Mangement. (FR12842).
I will get back to you when I have more information.
As we discussed in today's chat, my initial thought is that the XamaDataTree (v10.3) might actually work better for you, if you are able to use it in lieu of the XamMenu. However, I am still researching this with help from Development, and I will post back here when I have more information.
Can anyone help me binding the XamMenu to an ObservableCollection in a ViewModel. I'm not quite sure how to set up the HierarchyTemplate object. I am just getting empty menus but I know the observable collection is getting populated.