I have a RadMenu that gets its items from a database. Below is the code that correctly populates the items.
What i need is to be able to extract the Report object of type lu_Reports in the Menu ItemClick Event (part of which is also shown below). I can get the name of the report but i need to have the SelectedReport object which i have bound to another control on the page.
private void LoadMenuItems(ObservableCollection<
lu_Reports
> myRptList)
{
RadMenuItem parentItem;
RadMenuItem childItem;
try
{
if (myRptList != null)
{
foreach (var lu_Modules in _viewModel.ModulesList)
{
parentItem = new RadMenuItem() { Header = lu_Modules.ModuleName };
rptMenu.Items.Add(parentItem);
foreach (var obj in myRptList.Where(e=> e.ModuleID==lu_Modules.ModuleID))
{
childItem = new RadMenuItem() { Header = obj.ReportDescription, Name = obj.ReportName };
parentItem.Items.Add(childItem);
}
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void radMenu_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
RadMenuItem item = e.OriginalSource as RadMenuItem;
if (item != null)
{
}
}